Testing Training
The purpose of this repository is to help people learn the basics of testing in Swift. I decided to prepare this repository because many people reached out to ask for advice and guidance on testing their code. I think that this is the fastest way to help as many people as I can.
The idea is to read the theory and the examples in the repository, execute the exercises and ask for a code review. See the How To Work With This Repository section to know how to request help.
Content
Most of the concepts discussed here can be applied to many other programming languages, although you'll need to use the proper technology to apply them. For example, you will need to use JUnit specific assertEquals
instead of XCAssertEquals
from XCTest
. This makes this knowledge valuable, independently from your experience.
The repository is organized into chapters. We will start with the basics and with the tools. Moving on, we will analyze more complex problems, understanding how we can test them. For every chapter, I'll try to explain the theory, provide some examples and leave some exercises to work with the concepts.
Summary
- Basics and Pure Functions
- Tesing in An OOP Settings
- Working with Dependencies
- Avoiding Expectations in Tests
- Test Driven Development
- Snapshot Testing
- Basics of UITesting
Prerequisites
The requisites to fully profit from this repository are:
- Xcode. We will use Xcode 13.2 when developing the examples and exercises.
- a basic knowledge of Swift. We won't use super-advanced tricks, but you need to be comfortable with protocols and closures.
How to Work With This Repository
To request a review, you can follow this process:
- Fork this repository in your Github.
- Invite me to the repository (@cipolleshi).
- Choose a chapter you want to exercise with.
- Create a branch.
- Execute the exercises.
- Open a PR from your development branch to your
main
branch - Wait for my review. I usually receive the Github notification in the email, so I should be notified when there is a change. If I haven't reviewed the PR after one week, feel free to send me an email.
I hope this can help all of you improve your testing skills and, together with them, your software engineering skills.