Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run Gradle test and not Junit test in IntelliJ IDEA 15 when choosing configuration type to run with

I want this feature back I updated to Intellij 15.02 from 14 and wanted to run my tests using Gradle not JUnit, but I'm not getting the options anymore like the image you see here.

I want to be able to choose configuration type.

The thing that is happening now when I run a test is that it runs it as a JUnit test by default.

I have imported the gradle project with gradle by selecting the gradle file in the project. I have deleted each configuration entry at the top so everything is clean and empty when running a new test with Spock.

My current "fix" is to manually create a new config entry for the gradle test. Intellij is not intelligent enough to create that same Junit test as a Gralde test.

I'm confused.

like image 315
SamTheGoodOne Avatar asked Dec 17 '15 10:12

SamTheGoodOne


People also ask

How do I exclude a test in IntelliJ?

To exclude let's say "integration-test", you just need to specify as tags: ! integration-test , and IntelliJ will run all your JUnit5 tests except the ones tagged with integration-test . Take a look at this answer for details (including screenshot).

How do I run a specific test in Gradle?

You can do gradle -Dtest. single=ClassUnderTestTest test if you want to test single class or use regexp like gradle -Dtest. single=ClassName*Test test you can find more examples of filtering classes for tests under this link.


2 Answers

I found the solution. They have changed the way you select this option in the new version of intellij 15.02.

You have to select Gradle Test Runner.

Please take a look: enter image description here

like image 80
SamTheGoodOne Avatar answered Sep 23 '22 01:09

SamTheGoodOne


In modern versions of IntelliJ (I have Ultimate 2019.2.3) here's what you need to update: change gradle settings

Update from "Gradle" to "IntelliJ IDEA"

like image 21
Adolfo Avatar answered Sep 24 '22 01:09

Adolfo