unit-test-parameterized

Solid

Provides parameterized testing patterns with JUnit 5, generates data-driven unit tests using @ParameterizedTest, @ValueSource, @CsvSource, @MethodSource. Creates tests that run the same logic with multiple input values. Use when writing data-driven Java tests, multiple test cases from single method, or boundary value analysis.

Testing & QA 278 stars 32 forks Updated 5 days ago MIT

Install

View on GitHub

Quality Score: 91/100

Stars 20%
81
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# 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.jupite...

Details

Author
giuseppe-trisciuoglio
Repository
giuseppe-trisciuoglio/developer-kit
Created
7 months ago
Last Updated
5 days ago
Language
Python
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category