unit-test-parameterized

Creates JUnit 5 parameterized tests using @ValueSource, @CsvSource, and @MethodSource.

Updated Mar 2, 2026
One-click install
npx skills add https://github.com/MassimilianoPili/claude-code-config --skill unit-test-parameterized-massimilianopili
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: unit-test-parameterized
Source: https://github.com/MassimilianoPili/claude-code-config/tree/main/skills/unit-test-parameterized
Command: npx skills add https://github.com/MassimilianoPili/claude-code-config --skill unit-test-parameterized-massimilianopili

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill streamlines the process of writing unit tests by allowing you to run the same test logic with various input values, significantly reducing code duplication and improving test coverage.

Core Features & Use Cases

  • Parameterized Tests: Execute a single test method with multiple sets of arguments.
  • Data Sources: Supports various data sources like @ValueSource, @CsvSource, @MethodSource, and @EnumSource.
  • Use Case: When testing a validation function that needs to check numerous valid and invalid email formats, use @CsvSource to provide each email and its expected validity result to a single test method.

Quick Start

Use the unit-test-parameterized skill to write a parameterized JUnit 5 test using @ValueSource with strings "apple", "banana", and "cherry".

Frequently Asked Questions about unit-test-parameterized

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run a JUnit 5 test with multiple input values?

Run a JUnit 5 test with multiple inputs by applying the @ParameterizedTest annotation with data providers like @ValueSource, @CsvSource, or @MethodSource. This approach executes the same test method repeatedly across diverse data sets.

What is the best way to test multiple scenarios in Java without duplicating code?

The best way to test multiple scenarios without duplicating code is using parameterized tests. They execute a single test method with multiple sets of arguments, reducing code duplication while improving overall test coverage.

How do I use @CsvSource to validate different email formats in a parameterized test?

Use @CsvSource to validate different email formats by providing comma-separated values of inputs and expected results to your @ParameterizedTest method. This efficiently checks numerous valid and invalid email strings against expected validity.

Does JUnit 5 support data-driven testing for boundary values and error conditions?

Yes, JUnit 5 supports data-driven testing for boundary values and error conditions. By leveraging @ParameterizedTest with sources like @MethodSource, you can efficiently pass diverse data sets to test edge cases and error states.

When should I use @MethodSource instead of @ValueSource for Java unit testing?

Use @MethodSource instead of @ValueSource when your Java unit testing requires complex input arguments, multiple columns of data, or dynamically generated boundary values. @ValueSource is limited to single arrays of simple types like strings.