40

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.

SamTheGoodOne
  • 1,395
  • 2
  • 12
  • 19

2 Answers2

55

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

SamTheGoodOne
  • 1,395
  • 2
  • 12
  • 19
  • Do you have this working with 2016? I don't have the drop-down option and changing this setting doesn't seem to have an impact. – Snekse Jun 03 '16 at 21:15
  • 2016.1.3 also works. If not, refreshing Gradle helps. However. Android Studio 2.1 won't work and it's of no use to change the runner. – Farley Jun 11 '16 at 08:54
  • I can confirm that IntelliJ IDEA 2016.1.3 ignores this setting if you have a mixed Gradle project having Java & Android subprojects. –  Jun 15 '16 at 08:01
  • Thank you so much for this. – christophetd Nov 28 '16 at 14:19
  • Not working in 2018.1.4. Opened a bug on their ticketing system: https://youtrack.jetbrains.net/issue/IDEA-191291 – Eyal Roth May 02 '18 at 14:56
  • Actually, this is a problem only with Scalatest (JUnit runner works fine and delegates the work to Gradle). – Eyal Roth May 02 '18 at 17:08
  • It works for me for a java test in 2018.1. When running with JUnit runner, it fails. I adjusted to "Let me choose per test", and press ALT+SHIFT+F10 and selected the Gradle configuration for one specific test, and then the test passed. – Yngvar Kristiansen Jun 27 '18 at 08:09
  • The Gradle runner configuration setup is a bit different in IntelliJ 2019.2 - see https://stackoverflow.com/a/57751353/3059685 – Joman68 Sep 02 '19 at 04:17
  • This worked for me! Now the location in settings is `Build, Execution, Deployment >> Build Tools >> Gradle`. I set the field `Build and run using:` to `Gradle`. – craastad Mar 13 '23 at 12:28
23

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"

Adolfo
  • 798
  • 1
  • 7
  • 15