Cash App Jesse Wilson

Cash App's Kotlin Multiplatform parameterized tests with Burst

Original post 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

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.

Continue reading

What This Article Covers

Problem

Kotlin Multiplatform developers couldn't do parameterized testing the way JUnit users could with their various libraries and extensions.

Solution

Cash App built Burst 2.0, a Gradle plugin that lets you add @Burst annotations to test classes. You define test cases with burstValues() on constructor or function parameters.

Impact

Now you can write one test and have it run automatically across every parameter combination on all your Kotlin Multiplatform target platforms. No need to duplicate anything.

The article shows a clean WebServerTest example that tests HTTP/1, HTTP/2, and HTTP/3 protocols with just a few lines of code.

This page summarizes “Kotlin Multiplatform parameterized tests with Burst” by Cash App, published Oct 30, 2024. All credit for the original work goes to the authors.

Read the original on code.cash.app (opens in new tab)