Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tests coverage using Gradle in IntelliJ IDEA

Does anybody knows how to run tests with coverage using Gradle in IntelliJ IDEA? It seems that the option is missing from contextual menu and if invoked from left side of the screen the following problem is reported:

Error running **TestClass**
Cannot find runner for **TestClass**

No Gradle targets are run before import and Build, Execution, Deployment > Build Tools > Gradle > Runner > Delegate IDE build/run actions to gradle option is enabled.

like image 889
nucandrei Avatar asked Apr 19 '17 15:04

nucandrei


People also ask

How do I show test coverage in IntelliJ?

If you want to reopen the Coverage tool window, select Run | Show Code Coverage Data from the main menu, or press Ctrl+Alt+F6 . The report shows the percentage of the code that has been executed or covered by tests. You can see the coverage result for classes, methods, and lines.

How do you run a test case using Gradle command?

Use the command ./gradlew test to run all tests.

How do I create a test report in Gradle?

How to generate a Test Report. Gradle generates a Test Report automatically when it runs the entire Test Suite. To do the same, run ./gradlew test (or gradlew. bat test from Windows), or run the test Gradle task from your IDE.


1 Answers

Code coverage is not supported for Gradle test runner in IntelliJ IDEA at the moment, please follow the related request for updates:

  • IDEA-158659 'Run with Coverage' does nothing for Gradle build
like image 184
CrazyCoder Avatar answered Nov 06 '22 20:11

CrazyCoder