RFR: 7903934: Add support for query strings to the IntelliJ plugin [v4]
Maurizio Cimadamore
mcimadamore at openjdk.org
Thu Feb 6 15:00:27 UTC 2025
On Thu, 6 Feb 2025 14:36:40 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:
>> This patch adds support for JTReg query strings to the IntelliJ plugin. Query strings can be used to run individual test methods in JUnit and TestNG tests, and nested test classes (`@Nested`) in JUnit tests. When creating a run configuration from an element in a source file, e.g. by clicking on the little green 'play' button in the margin, the plugin will automatically compute a query string to run that element (if it knows how to).
>>
>> One issue I faced when implementing this, is that the IntelliJ type API `PsiType` does not have a way to retrieve the binary name of that type, which is required to run JUnit tests that have parameters. So, I had to manually implement this. You'll see this back in the code.
>>
>> I've tested this by creating and running a variety of configurations for different test methods, accepting different parameter types, as well as running `@Nested` test classes.
>>
>> Here is a picture of what the new configuration UI looks like:
>>
>> 
>>
>> The 'Query string' field can only be used in combination with the `File` field, and is disabled otherwise.
>
> Jorn Vernee has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains seven commits:
>
> - Merge branch 'master' into RunMethods
> - update notes
> - Update wrapper validation action
> - Use qualified class name, for the sake of nested test classes
> - move query string text field + tie to file selection
> - use new query string format
> - Support query string in idea plugin
Very nice extension, thanks!
plugins/idea/gradle.properties line 7:
> 5: # https://plugins.jetbrains.com/plugin/23025-ant
> 6: antSupportVersion = 242.20224.159
> 7: pluginVersion = 1.17
bump version please
plugins/idea/src/main/java/com/oracle/plugin/jtreg/configuration/producers/JTRegConfigurationProducer.java line 131:
> 129: String qualName = cls.getQualifiedName();
> 130: String packageName = qualName.substring(0, qualName.length() - nestedName.length());
> 131: return packageName + nestedName.replace('.', '$');
Boy this is pretty ugly (not your fault - can't find a way to get package from class)
-------------
Marked as reviewed by mcimadamore (Reviewer).
PR Review: https://git.openjdk.org/jtreg/pull/240#pullrequestreview-2598937341
PR Review Comment: https://git.openjdk.org/jtreg/pull/240#discussion_r1944874960
PR Review Comment: https://git.openjdk.org/jtreg/pull/240#discussion_r1944874514
More information about the jtreg-dev
mailing list