Getting Started with Swift Testing
Apple introduced Swift Testing during WWDC24. It is a new framework that makes it easy for you to test your Swift code using expressive and intuitive APIs.
In this chapter, you’ll create and run tests for the JournalEntry
class to make sure it works as intended.
You’ll start by adding a new Unit Testing target to your app. Next, you’ll write some tests for the JournalEntry
class, and finally, you’ll run the tests on your JournalEntry
class to make sure it works as it should.
By the end of this chapter, you’ll have learned how to write tests for the classes in your app to make sure that they work as intended. This will be useful for larger projects involving many people, where you are not able to view the source code for all the classes in your project.
The following topics will be covered:
- Introducing Swift Testing
- Adding a Unit Testing target to your app
- Writing tests for...