6

The question says it all really. How can I download or view the surefire-reports generated during a build on Travis?

acorello
  • 4,473
  • 4
  • 31
  • 46

4 Answers4

4

You can just do

after_failure:
  - cat target/surefire-reports/*.txt
sujithvm
  • 2,351
  • 3
  • 15
  • 16
  • @ImranAliKhan Question asked was to view the surefire reports on travis and I guess the above snippet does the job. Thanks – sujithvm Jul 06 '15 at 07:58
3

Having not found a direct way to access the surefire-report files I came up with the this workaround:

In .travis.yml I added an after_failure hook:

after_failure: print_surefire_reports.sh

In the hook print_surefire_reports.sh I put:

#!/usr/bin/env sh
echo "Current directory is $(pwd)"
echo "\n=== SUREFIRE REPORTS ===\n"

for F in target/surefire-reports/*.txt
do
    echo $F
    cat $F
    echo
done
acorello
  • 4,473
  • 4
  • 31
  • 46
2

I am using python html2text in travis after script phase.

My travis script looks like:

after_script:
- python html2text.py target/site/surefire-report.html

surefire-report.html is generated by surefire-report-plugin

See example output here: https://travis-ci.org/rmpestano/dbunit-rules/builds/160170324#L3541

rmpestano
  • 838
  • 1
  • 8
  • 17
0

Based on this bug report and this question, there is not a clean way to do this. There are, however, a couple unsupported methods of getting the reports listed in the bug report.

Those may provide options for you to look into, but the Travis CI maintainers have not provided or supported an explicit way to handle this yet. Note that those bug reports/questions are well over a year old too.

The prevailing suggestion in those threads seems to be to have Travis recommit the build artifacts back to the user's repository. This, however, requires authentication, which you probably shouldn't store in your .travis.yml file

Andy
  • 49,085
  • 60
  • 166
  • 233
  • Thanks for the suggestion. I don't know how to package the surefire reports in an artifact. But it seems to me an overkill: the test results should be available on the CI server IMO. In the mean time I found a workaround which I'm posting above. – acorello Oct 30 '13 at 17:36
  • if one wants to commit something from travis job, authentication keys can and should be encrypted. But I see no problem in other answers offered in this thread just printing the reports. – eis Aug 22 '15 at 09:10