Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to read test result reports on Travis CI?

For my builds on Travis, I want to be able to read the test results when there are failing tests to see the stacktrace of those failing tests. Currently, these reports are stored locally on the machine that runs the tests, so I am not able to access the local files where the reports are.

I also don't want to archive these files through Amazon S3 because that seems like way too much of a hassle.

Something like : How to get surefire reports form Travis-CI build? seems like it could work, but also seems complicated.

Basically, I want to be able to read a local test result file from Travis without going through S3.

like image 672
Caren Avatar asked Feb 19 '15 19:02

Caren


People also ask

Which of the following are two main parts of Travis CI job?

The first job is to build the image and the second job is going to be to run the NPM test target.

What is Travis CI used for?

As a continuous integration platform, Travis CI supports your development process by automatically building and testing code changes, providing immediate feedback on the success of the change. Travis CI can also automate other parts of your development process by managing deployments and notifications.


2 Answers

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

like image 155
Rene Groeschke Avatar answered Sep 28 '22 20:09

Rene Groeschke


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.

like image 40
Ywain Avatar answered Sep 28 '22 19:09

Ywain