Skip to content

Commit

Permalink
Add an example of parameterized tests to @WithJenkins Javadoc (#927)
Browse files Browse the repository at this point in the history
Co-authored-by: Tim Jacomb <[email protected]>
  • Loading branch information
jeromepochat and timja authored Feb 21, 2025
1 parent 256947e commit 3ed9c39
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/main/java/org/jvnet/hudson/test/junit/jupiter/WithJenkins.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,33 @@
*
* </blockquote>
*
* <p>Parameterized tests need to accept {@link JenkinsRule JenkinsRule} parameter in a
* {@link org.junit.jupiter.api.BeforeEach BeforeEach} or
* {@link org.junit.jupiter.api.BeforeAll BeforeAll} annotated method. </p>
*
* <blockquote>
*
* <pre>
* &#64;WithJenkins
* class ExampleJUnit5Test {
*
* private JenkinsRule r;
*
* &#64;BeforeEach
* public void setUp(JenkinsRule r) {
* this.r = r;
* }
*
* &#64;ParameterizedTest
* &#64;ValueSource(strings = { "one", "two", "three" })
* public void example(String param) {
* // use 'r' ...
* }
* }
* </pre>
*
* </blockquote>
*
* @see JenkinsExtension
* @see org.junit.jupiter.api.extension.ExtendWith
*/
Expand Down

0 comments on commit 3ed9c39

Please sign in to comment.