Gradle –如何在控制台中显示测试结果?

默认情况下, gradle test显示简单的构建成功消息。

Terminal
$ gradle clean test

BUILD SUCCESSFUL in 1s

PS已通过Gradle 5.6.2测试

要在控制台中显示测试结果,请包括以下testLogging

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

//...

参考文献

  • 在Java和JVM项目中进行测试
  • Gradle TestLoggingContainer
  • Gradle TestLogEvent
  • Gradle –如何排除一些测试

翻译自: https://mkyong.com/gradle/gradle-display-test-results-in-console/

你可能感兴趣的:(java,测试,开发工具)