logginggradlejunitreportingtravis-ci

How to get more junit-failed-details in gradle log without running gradle in debug mode


Question:

Is there a way to add the details of failed junit4 tests to gradle output witout making all of gradle more verbose?

Background:

I have a java-se junit4 regression test for handling ical content that works fine on my win-7-64 local machine but that fails on travis-ci buildserver using gradle.

when i run

./gradlew assemble libIcsJ2se:test

the gradle output from travis-ci log contains this

* What went wrong:

Execution failed for task ':libIcsJ2se:test'.

> There were failing tests. See the report at: 
> file:///home/travis/build/k3b/CalendarIcsAdapter/libIcsJ2se/build/reports/tests/index.html

However i have no access to this file because it is on the build server so i cannot find out wich test failed and why.

when i run gradle in debug mode

./gradlew -d assemble libIcsJ2se:test

I see this in the log what i want:

07:06:56.713 [DEBUG] [TestEventLogger] de.k3b.calendar.DtoIcRegressonsTests > shouldBeSameFixThisEvent STARTED
07:06:56.713 [DEBUG] [TestEventLogger] 
07:06:56.713 [DEBUG] [TestEventLogger] de.k3b.calendar.DtoIcRegressonsTests > shouldBeSameFixThisEvent FAILED
07:06:56.714 [DEBUG] [TestEventLogger]     org.junit.ComparisonFailure: expected:

<...
TART:20000502T123456
[DTEND:20000502T171234]
SUMMARY:test title
...> but was:<...
TART:20000502T123456[Z
DTEND:20000502T171234Z]
SUMMARY:test title
...>
07:06:56.717 [DEBUG] [TestEventLogger]         at de.k3b.calendar.DtoIcRegressonsTests.shouldBeSameFixThisEvent(DtoIcRegressonsTests.java:482)

However the gradle debug output contains many more details unrelated to junit-tests.

Is there a way to add only the details of the failed junit4 tests to gradle output witout making all of gradle more verbose?


Solution

  • Please read the documentation of TestLoggingContainer to see how to configure what is logged when running tests.