How to read test result reports on Travis CI?

那年仲夏 提交于 2019-12-02 22:01:53

The easiest way to get useful output on the console about failing tests is to use the gradle test logging.

test {
    testLogging {
        events "failed"
        exceptionFormat "short"
    }
}

For details and more options here have a look at the according chapter in the gradle userguide: http://gradle.org/docs/current/dsl/org.gradle.api.tasks.testing.logging.TestLoggingContainer.html

To expand on Rene Groeschke's answer, I found the following configuration to be a good compromise for Travis:

test {
    testLogging {
        events "passed", "skipped", "failed"
        exceptionFormat "full"
    }
}

This will result in an output like the following:

com.package.SomeClassTest > testPass PASSED

com.package.SomeClassTest > testSkip SKIPPED

com.package.SomeClassTest > testFail FAILED
    java.lang.AssertionError: expected:<false> but was:<true>
        at org.junit.Assert.fail(Assert.java:88)
        at org.junit.Assert.failNotEquals(Assert.java:834)
        at org.junit.Assert.assertEquals(Assert.java:118)
        at org.junit.Assert.assertEquals(Assert.java:144)
        at com.package.SomeClassTest.testFail(SomeClassTest.java:42)

3 tests completed, 1 failed, 1 skipped

The test report will still be generated, so you can consult it when running the tests locally.

Try adding --info to your command:

./gradlew test --info

If you want more, try:

./gradlew test --debug
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!