
Unit Test Parameterized
Generate JUnit 5 parameterized tests with @ParameterizedTest and ValueSource, CsvSource, or MethodSource to cut duplication and cover boundary cases.
Overview
Unit Test Parameterized is an agent skill most often used in Ship (also Build backend) that generates JUnit 5 @ParameterizedTest patterns with ValueSource, CsvSource, and MethodSource for data-driven Java tests.
Install
npx skills add https://github.com/giuseppe-trisciuoglio/developer-kit --skill unit-test-parameterizedWhat is this skill?
- 5-step flow: dependency, choose source, match parameters, display names, run Gradle or Maven test
- Covers @ValueSource, @CsvSource, @MethodSource, @EnumSource, and @ArgumentsSource
- Boundary and multi-scenario coverage from a single test method
- Custom name templates for readable CI output
- Maven and Gradle validation via test --info or mvn test
- 5-step parameterized test instruction flow
Adoption & trust: 1.2k installs on skills.sh; 271 GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You repeat the same assertion logic across many JUnit tests instead of running one method over many inputs and edge cases.
Who is it for?
Indie Java developers shipping services who want concise boundary and scenario coverage without test boilerplate.
Skip if: Non-JVM projects, full integration or E2E suites that need Spring context—not pure parameterized unit scope.
When should I use this skill?
Writing data-driven Java tests, multiple cases from one method, or boundary value analysis with JUnit 5.
What do I get? / Deliverables
You get copy-ready parameterized test templates and a validation step so Gradle or Maven runs every input combination with clear display names.
- @ParameterizedTest methods with chosen argument sources
- Verified green test run via Gradle or Maven
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
Parameterized unit tests are introduced when hardening code before release—the canonical Ship/testing shelf. Testing subphase owns data-driven Java unit patterns; Build may use them while coding but quality gates belong under Ship.
Where it fits
Collapse ten nearly identical assert tests into one @CsvSource table before a release candidate.
Add @MethodSource factories while implementing a pricing or validation module in Java.
Extend parameterized cases after a production bug reveals a missed enum or edge input.
How it compares
JUnit parameterized patterns skill—not a mutation-testing or coverage MCP tool.
Common Questions / FAQ
Who is unit-test-parameterized for?
Solo builders writing Java unit tests with JUnit 5 who need multiple inputs per method without duplicating test bodies.
When should I use unit-test-parameterized?
In Ship testing when hardening releases with boundary analysis; also in Build backend while adding tests alongside new Java logic.
Is unit-test-parameterized safe to install?
Review the Security Audits panel on this Prism page; the skill may write test files and run Bash for mvn or gradle test in your repo.
SKILL.md
READMESKILL.md - Unit Test Parameterized
# Parameterized Unit Tests with JUnit 5 ## Overview Provides patterns for parameterized unit tests in Java using JUnit 5. Covers `@ValueSource`, `@CsvSource`, `@MethodSource`, `@EnumSource`, `@ArgumentsSource`, and custom display names. Reduces test duplication by running the same test logic with multiple input values. ## When to Use - Writing JUnit tests with multiple input combinations - Implementing data-driven tests in Java - Running same test with different values (boundary analysis) - Testing multiple scenarios from single test method ## Instructions 1. **Add dependency**: Ensure `junit-jupiter-params` is on test classpath (included in `junit-jupiter`) 2. **Choose source**: `@ValueSource` for simple values, `@CsvSource` for tabular data, `@MethodSource` for complex objects 3. **Match parameters**: Test method parameters must match data source types 4. **Set display names**: Use `name = "{0}..."` for readable output 5. **Validate**: Run `./gradlew test --info` or `mvn test` and verify all parameter combinations execute ## Examples ### Maven / Gradle Dependency JUnit 5 parameterized tests require `junit-jupiter` (includes params). Add `assertj-core` for assertions: ```xml <!-- Maven --> <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter</artifactId> <scope>test</scope> </dependency> ``` ```kotlin // Gradle testImplementation("org.junit.jupiter:junit-jupiter") ``` ### `@ValueSource` — Simple Values ```java import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; import static org.assertj.core.api.Assertions.*; @ParameterizedTest @ValueSource(strings = {"hello", "world", "test"}) void shouldCapitalizeAllStrings(String input) { assertThat(StringUtils.capitalize(input)).isNotEmpty(); } @ParameterizedTest @ValueSource(ints = {1, 2, 3, 4, 5}) void shouldBePositive(int number) { assertThat(number).isPositive(); } @ParameterizedTest @ValueSource(ints = {Integer.MIN_VALUE, -1, 0, 1, Integer.MAX_VALUE}) void shouldHandleBoundaryValues(int value) { assertThat(Math.incrementExact(value)).isGreaterThan(value); } ``` ### `@CsvSource` — Tabular Data ```java import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; @ParameterizedTest @CsvSource({ "alice@example.com, true", "bob@gmail.com, true", "invalid-email, false", "user@, false", "@example.com, false" }) void shouldValidateEmailAddresses(String email, boolean expected) { assertThat(UserValidator.isValidEmail(email)).isEqualTo(expected); } ``` ### `@MethodSource` — Complex Data ```java import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import java.util.stream.Stream; @ParameterizedTest @MethodSource("additionTestCases") void shouldAddNumbersCorrectly(int a, int b, int expected) { assertThat(Calculator.add(a, b)).isEqualTo(expected); } static Stream<Arguments> additionTestCases() { return Stream.of( Arguments.of(1, 2, 3), Arguments.of(0, 0, 0), Arguments.of(-1, 1, 0), Arguments.of(100, 200, 300) ); } ``` ### `@EnumSource` — Enum Values ```java @ParameterizedTest @EnumSource(Status.class) void shouldHandleAllStatuses(Status status) { assertThat(status).isNotNull(); } @ParameterizedTest @EnumSource(value = Status.class, names = {"ACTIVE", "INACTIVE"}) void shouldHandleSpecificStatuses(Status status) { assertThat(status).isIn(Status.ACTIVE, Status.INACTIVE); } ``` ### Custom Display Names ```java @P