SwiftUI Unit tests
up:: SwiftUI onboarding
- Unit tests are in a separate target. They don’t get compiled and sent to the App Store
- New > Target > Unit Testing Bundle
- New file: Unit test class file
- For each View, create a new test file
- Each function must start with
test
- naming structure:
test_UnitOfWork_StateUnderTest_ExpectedBehaviour
- eg:
test_UserListViewModel_isPremium_shouldBeTrue
- eg:
- testing structure:
- Given
- When
- Then
- naming structure: