Gradle – How to display test result in console?

By default, gradle test displays nothing but a simple build successful message.

Terminal

$ gradle clean test

BUILD SUCCESSFUL in 1s

P.S Tested with Gradle 5.6.2

Solution

To display the test result in the console, includes the testLogging like this:

gradle.build

test {

	useJUnitPlatform()

	testLogging {
		events "passed", "skipped", "failed"
	}

}
Terminal

$ gradle clean test

> Task :test

com.mkyong.AssumptionsTest > testOnlyOnDevEnvElseAbortWithCustomMsg() SKIPPED

com.mkyong.AssumptionsTest > testAssumingThat() PASSED

com.mkyong.AssumptionsTest > testOnlyOnDevEnvElseAbort() SKIPPED

com.mkyong.conditional.EnvVariableTest > onIntel64() PASSED

com.mkyong.conditional.EnvVariableTest > printEnvironmentProperties() SKIPPED

//...

References

About the Author

author image
mkyong
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.

Comments

avatar