KotlinFixt-your tests
summary
Generates real Kotlin objects with random but constrained values using KotlinFixture and the pattern called constrained nondeterminism, replacing hundreds of hardcoded lines in a real codebase. Defaults produce collections of size repeatCount=5 unless overridden; tests set repeatCount to 0, 1, or a range (0..10) and pin a rating to 4.5001..5.0 to force five stars. Library handles nullable types, default params, abstract subclasses, Java Faker, and is used to find serialization and flaky-test failures by repeating runs.
AI-written summary · about
chapters (16)
- 0:00Introduction to test data
- 1:18Problem with hardcoded test data
- 3:07Demo of movie test setup
- 8:44Factory functions for test objects
- 12:26Introducing KotlinFixture
- 13:53Using KotlinFixture in tests
- 16:26Repeat count for test coverage
- 18:57Testing star rating logic
- 20:46Handling nullable types
- 21:28Support for abstract classes
- 22:32Best practices with constraints
- 24:46Sharing fixture configuration
- 26:47Simplifying real-world test data
- 30:52Testing parcelable objects
- 32:58Advanced KotlinFixture features
- 34:36Q&A on randomized fixtures
