From the course: Gradle for Java-Based Applications and Libraries

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Executing tests and inspecting the results

Executing tests and inspecting the results

From the course: Gradle for Java-Based Applications and Libraries

Start my 1-month free trial

Executing tests and inspecting the results

- [Instructor] It's time to exercise the tests. The task for running the tests is called test. That's a task provided by the Java plugin. Gradle's test execution engine looks for a JUnit 4 test by default. You will have to indicate to Gradle that you will want to use JUnit 5 instead. To do so, we have to make a method call named useJunitPlatform on the test task. So let's do that. Now let's actually execute the test task with gradlew test. And you can see upon execution of the command, Gradle test, the tests pass. The build is all fine. The console output of Gradle isn't very wordy. You might have seen a little counter fly by. So how do you know what tests have been executed? One way to view the results is by opening the HTML report Gradle creates automatically. You can find the index page in the directory build/reports/tests/test. Let's have a look at it. Opening the report in the browser breaks down the…

Contents