RFR: 7903930: Support running individual parameterized tests and @Nested test classes [v6]
Christian Stein
cstein at openjdk.org
Mon Jan 20 16:26:53 UTC 2025
On Fri, 17 Jan 2025 16:36:35 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:
>> See the JBS issue for an extended problem description.
>>
>> This PR adds support for running individual parameterized JUnit test methods, as well as nested test classes, by adding a new flavor of query string, prefixed with `junit-select`:
>>
>>
>> junit-select:<selector>
>>
>>
>> This intends to take direct advantage of JUnits selector string support. The supported selectors are listed in the column on the right in the table here: https://junit.org/junit5/docs/current/user-guide/#running-tests-discovery-selectors
>>
>> For example, running a method `foo` that takes no parameters could be done using `foo`, just like before. If `foo` has parameters, then for JUnit tests they have to be specified as a comma separated list of binary names. For that we can use the `method` selector. For example:
>>
>>
>> junit-select:method:TestDowncallScope#testDowncall(int,java.lang.String,CallGeneratorHelper$Ret,java.util.List,java.util.List)
>>
>>
>> This support is intended to be used by the intellij plugin to support running individual methods and nested classes (see https://github.com/openjdk/jtreg/pull/240).
>>
>> Testing: I've added additional tests for the new cases. I've also been using a PoC of this feature as the basis for similar support in the intellij plugin that I'm working on.
>
> Jorn Vernee has updated the pull request incrementally with one additional commit since the last revision:
>
> add test case for prior fix
Thanks for implementing this feature, Jorn, with updates to the FAQ and tests.
Nit: please delete unused import statements and add a line to the `CHANGELOG.md` file
src/share/classes/com/sun/javatest/regtest/agent/JUnitRunner.java line 50:
> 48: import java.lang.reflect.Method;
> 49: import java.time.Duration;
> 50: import java.util.List;
Remove unused import statement.
Suggestion:
src/share/classes/com/sun/javatest/regtest/agent/JUnitRunner.java line 56:
> 54: import java.util.concurrent.locks.Lock;
> 55: import java.util.concurrent.locks.ReentrantLock;
> 56: import java.util.stream.Collectors;
Remove unused import statement.
Suggestion:
src/share/classes/com/sun/javatest/regtest/config/TestManager.java line 112:
> 110: static final Pattern groupPtn = System.getProperty("os.name").matches("(?i)windows.*")
> 111: ? Pattern.compile("(?<dir>|[^A-Za-z?]|[^?]{2,}):(?<group>[A-Za-z0-9_,]+)")
> 112: : Pattern.compile("(?<dir>[^?]*):(?<group>[A-Za-z0-9_,]+)");
Good improvement!
-------------
Changes requested by cstein (Committer).
PR Review: https://git.openjdk.org/jtreg/pull/241#pullrequestreview-2562779875
PR Review Comment: https://git.openjdk.org/jtreg/pull/241#discussion_r1922634512
PR Review Comment: https://git.openjdk.org/jtreg/pull/241#discussion_r1922634670
PR Review Comment: https://git.openjdk.org/jtreg/pull/241#discussion_r1922635436
More information about the jtreg-dev
mailing list