Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't run and debug groovy tests under intellij idea

I try to embed groovy test to java project. I start with spock examples - https://github.com/spockframework/spock-example

Examples is compile and execute by running maven goal test but if i try to run test under intellij idea (ctrl+F10 under test method) it failure with classpath error.

Error running HelloSpockSpec.length of Spock's and his friends' names: Class 'HelloSpockSpec' not found in module 'spock-example'

I try to apply advices from IntelliJ + Groovy + Spock but it didn't help.

like image 625
Torsten Avatar asked Jul 01 '15 14:07

Torsten


People also ask

How do I debug a Groovy script in IntelliJ?

Test a Groovy applicationPress Ctrl+Shift+T and select Create New Test. In the dialog that opens, specify your test settings and click OK. Open the test in the editor, add code and press Ctrl+Shift+F10 or right-click the test class and from the context menu select Run 'test name'.

How do I debug test cases in IntelliJ?

Debug failed tests If you don't know why a test fails, you can debug it. In the editor, click the gutter on the line where you want to set a breakpoint. There are different types of breakpoints that you can use depending on where you want to suspend the program. For more information, refer to Breakpoints.

Does IntelliJ support Groovy?

Groovy The Groovy plugin is bundled with IntelliJ IDEA and enabled by default. IntelliJ IDEA supports the latest stable version of Groovy and Groovy 4 syntax.


1 Answers

Don't forget to mark the folder as "Test Sources" in IntelliJ

Then it should work as expected :-)

like image 93
tim_yates Avatar answered Oct 14 '22 06:10

tim_yates