apache / apache/grails-intellij-plugin

Call to Grails test runner is not constructed correctly if test method name is a String literal

Open
#344 0 comments 0 reactions 0 assignees View on GitHub
bug imported-from-youtrack
Dominant language
Java
Stars
17
Forks
4
Avg merge
5d 15h
Merged PRs (30d)
4

Description

In out Grails 2.5.6 application, we have lots of tests with descriptive names, e.g.
```
void "Search: Fail helpfully if there's no mapping and the given community ID is bad"() {
...
}
```
Creating a run configuration for this single test method (e.g. via the gutter icon) does not work properly; the created command (as shown in the configuration editor) is:
```
test-app integration: "MySpec.Search: Fail helpfully if there's no mapping and the given community ID is bad" -echoOut
```
Running this configuration executes the whole test suite.

NB: If only this test fails, "re-run failed tests" creates this command:
```
/home//rreitzig/.sdkman/candidates/java/8.0.181-oracle/bin/java -Dgrails.home=/home//rreitzig/.sdkman/candidates/grails/2.5.6 -Dtools.jar=/home//rreitzig/.sdkman/candidates/java/8.0.181-oracle/lib/tools.jar -Dgroovy.starter.conf=/home//rreitzig/.sdkman/candidates/grails/2.5.6/conf/groovy-starter.conf -Dgrails.full.stacktrace=true -Dbase.dir=/home//rreitzig/Code/hds-webapp -Dgrails.build.listeners=org.jetbrains.groovy.grails.rt.GrailsIdeaTestListener -Dfile.encoding=UTF-8 -classpath /home//rreitzig/.sdkman/candidates/grails/2.5.6/lib/org.codehaus.groovy/groovy-all/jars/groovy-all-2.4.10.jar:/home//rreitzig/.sdkman/candidates/grails/2.5.6/dist/grails-bootstrap-2.5.6.jar org.codehaus.groovy.grails.cli.support.GrailsStarter --classpath /home//rreitzig/.local/share/JetBrains/Toolbox/apps/IDEA-U/ch-0/183.5429.30/plugins/Grails/lib/grails-rt.jar --main org.codehaus.groovy.grails.cli.GrailsScriptRunner --conf /home//rreitzig/.sdkman/candidates/grails/2.5.6/conf/groovy-starter.conf "test-app integration: \"com.digithurst.hdspro.administrative.MappingServiceSpec.\\"Search: there's bad\\" -echoOut com.digithurst.hdspro.administrative.MappingServiceSpec.Search: Fail helpfully if there's no mapping and the given community ID is bad\" -plain-output"
```
It fails with:
```
| Error Error processing command line arguments: unbalanced quotes in test-app integration: "com.digithurst.hdspro.administrative.MappingServiceSpec.\"Search: there's bad\" -echoOut com.digithurst.hdspro.administrative.MappingServiceSpec.Search: Fail helpfully if there's no mapping and the given community ID is bad" -plain-output
```
This seems to be specific to the single quote; without it, we get:
```
/home//rreitzig/.sdkman/candidates/java/8.0.181-oracle/bin/java -Dgrails.home=/home//rreitzig/.sdkman/candidates/grails/2.5.6 -Dtools.jar=/home//rreitzig/.sdkman/candidates/java/8.0.181-oracle/lib/tools.jar -Dgroovy.starter.conf=/home//rreitzig/.sdkman/candidates/grails/2.5.6/conf/groovy-starter.conf -Dgrails.full.stacktrace=true -Dbase.dir=/home//rreitzig/Code/hds-webapp -Dgrails.build.listeners=org.jetbrains.groovy.grails.rt.GrailsIdeaTestListener -Dfile.encoding=UTF-8 -classpath /home//rreitzig/.sdkman/candidates/grails/2.5.6/lib/org.codehaus.groovy/groovy-all/jars/groovy-all-2.4.10.jar:/home//rreitzig/.sdkman/candidates/grails/2.5.6/dist/grails-bootstrap-2.5.6.jar org.codehaus.groovy.grails.cli.support.GrailsStarter --classpath /home//rreitzig/.local/share/JetBrains/Toolbox/apps/IDEA-U/ch-0/183.5429.30/plugins/Grails/lib/grails-rt.jar --main org.codehaus.groovy.grails.cli.GrailsScriptRunner --conf /home//rreitzig/.sdkman/candidates/grails/2.5.6/conf/groovy-starter.conf "test-app integration: -echoOut com.digithurst.hdspro.administrative.MappingServiceSpec.Search: Fail helpfully if there is no mapping and the given community ID is bad -plain-output"
```
Which runs successfully but exectues _no_ test.

---

*Imported from [IDEA-206488](https://youtrack.jetbrains.com/issue/IDEA-206488) · Type: Bug · Votes: 0*
*Comments, attachments, dates and reporter are not part of the export — follow the link above for the full history.*

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the issue from the gutter icon by creating a run configuration for a descriptive single test method, then inspect how the Grails test runner command is constructed and quoted. Compare it with the failing test-app command shown in the report. Done means the generated configuration preserves the full method name, including apostrophes, and runs only that test without unbalanced quotes.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
testing, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.