-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce support for parameterized tests #14
Comments
@elygre, thanks for raising this issue. We will certainly provide a mechanism for parameterized tests. We just haven't gotten to it yet in the prototype. However, we do already have generic support for supplying parameters to methods. This can be achieved by implementing a custom Thus, the We will post back here once we begin work on that front. Regards, Sam |
This commit introduces a new @InvocationIndex annotation for injecting the current invocation index into @test, @beforeeach, and @AfterEach methods. Furthermore, support has been added for injecting the repetition count for @RepeatedTest methods using @InvocationIndex. Issues: #14, #214
This commit introduces a new @InvocationIndex annotation for injecting the current invocation index into @test, @beforeeach, and @AfterEach methods. Furthermore, support has been added for injecting the repetition count for @RepeatedTest methods using @InvocationIndex. Issues: #14, #214
Update: I have opted to remove support for |
@marcphilipp, to answer my previous question on my own... I discovered this example: @ParameterizedTest
@CsvSource("foo")
@MethodSource(names = { "first", "second" })
@ArgumentsSource(MyArgumentsProvider.class)
@CsvFileSource(resources = { "/single-column.csv", "two-column.csv" })
void testWithMultipleDifferentSources(String parameter) {
} So that obviously works. 😉 I don't think I would personally use that feature (combining multiple sources for the same parameterized test), but I suppose some people will find it useful. Out of curiosity, is this use case something you've seen in the wild or had a feature request for? |
@junit-team/junit-lambda, we need to decide if it makes sense to have something like |
FYI: #704 is a follow-up to this issue. |
FYI: as a follow up to the discussion regarding whether or not we need |
Regarding the need for an See comments here: #704 (comment) |
Thanks for all the hard work, guys! Remaining work ( |
Deliverables
@TestTemplate
and accompanying extension point.@InvocationIndex
annotation orTestTemplateInfo
type for injecting the current invocation index, etc. into@Test
,@BeforeEach
, and@AfterEach
methods.junit-jupiter-params
module@since
tags@TestTemplate
and accompanying extension pointin User Guide andRelease NotesProvide example(s) in theWill be addresses in Document @TestTemplate and accompanying extension point in User Guide #762documentation
module and include in the User Guide.junit-jupiter-params
module in the Dependency Metadata section.junit-jupiter-params
module in the Dependency Diagram.documentation
module and include in the User Guide.Original Issue Description
At the time of writing, the https://github.com/junit-team/junit-lambda/wiki/Prototype-Test-Decorators page does not have all that much detail, so this might already be considered.
It would be good if the library shipped with ready-to-use simple parameter annotations that could be used inside a single test instance. It would in many ways look like JUnit 4's
@Parameterized
Runner, but for use inside a single class. When running the test, each@Parameterized
method would appear many times, once for each data set.Related Issues
The text was updated successfully, but these errors were encountered: