DevTesting is a small Swift 6 package that contains useful additions for writing tests with Swift Testing.
SeedableRandomNumberGeneratoris a random number generator that can be seeded to enable repeatable tests with random values.RandomValueGeneratinguses a seedable random number generator to repeatably generate values in your test suite. It logs the seed before every test so that you can debug tests that failed. It also includes convenient functions for generating random values:- Booleans
- Case iterables
- Data
- Dates
- Floating point types
- Integer types
- Optionals
- Strings
- UUIDs
- URLs, URL components, and URL query items
StubandThrowingStubprovide stubbing and spying functionality for your mock objects.
DevTesting is fully documented and tested and supports version 26 of Apple’s OSes.
View our changelog to see what’s new.
DevTesting requires a Swift 6.2+ toolchain to build. We only test on Apple platforms. We follow the Swift API Design Guidelines. We take pride in the fact that our public interfaces are fully documented and tested. We aim for overall test coverage over 99%.
To set up the development environment:
- Run
Scripts/install-git-hooksto install the pre-push hook that automatically checks code formatting before pushing. - Use
Scripts/lintto manually check code formatting at any time. - Use
Scripts/formatto auto-fix code formatting issues.
DevTesting uses GitHub Actions for continuous integration. The CI pipeline:
- Linting: Automatically checks code formatting on all pull requests using
swift format - Testing: Runs tests on iOS, macOS, tvOS, and watchOS
- Coverage: Generates code coverage reports using xccovPretty
Find a bug? Want a new feature? Create a GitHub issue and we’ll take a look.
All code is licensed under the MIT license. Do with it as you will.