Kotlin Multiplatform parameterized tests with Burst
Article Summary
Cash App just open-sourced Burst 2.0, bringing parameterized testing to Kotlin Multiplatform. No more writing the same test multiple times for different inputs.
Jesse Wilson from Cash App announced Burst 2.0, a Gradle plugin that fills a major gap in Kotlin Multiplatform testing. While JUnit has had parameterized tests for years (via Burst 1.0, TestParameterInjector, and @ParameterizedTest), KMP projects have been missing this capability until now.
Key Takeaways
- Add @Burst annotation to test classes and parameters to constructors or functions
- Automatically tests all combinations across every KMP target platform
- Enums and booleans work without burstValues(), testing all possible values
- First argument in burstValues() becomes default for IDE testing
- Spiritual successor to Square's original Burst library, hence version 2.0
Critical Insight
Burst 2.0 brings parameterized testing to Kotlin Multiplatform, letting you write one test and run it across multiple algorithms, inputs, and environments automatically.