Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate JUnit test reports on android for jenkins

I'am trying to make use of the "Publish JUnit test result report" in Jenkins, but can't get it to work for my android test project. The setup of my android test project in Jenkins is based on this guide: https://wiki.jenkins-ci.org/display/JENKINS/Building+an+Android+app+and+test+project

I hope someone could post an easy step by step guide on how to get the JUnit test result reports out of the test run to being able to use "Publish JUnit test result report". Would like to use this feature because the standard console output of the Junit tests in Jenkins are not quite convenient.

I found some guides (not so many) on the Internet, but non of them worked for me. This is what I tried so far (with no success):

  • Just adding the "Publish JUnit test result report" post-build-action with no arguments
  • Followed this guide, which suggests, that the reports can be downloaded from the device/emulator ( http://blackriver.to/2012/08/android-continuous-integration-with-ant-and-jenkins-part-2-2/ )
  • Then this guide ( http ://blog.cloudbees.com/2012/11/unit-test-results-code-coverage-and.html ) which is similar to the previous guide, but adds a custom instrumentation library
  • And then I have found this API for ant on junit reports ( http:// ant.apache.org/manual/Tasks/junitreport.html ) but I have absolutly no idea how to add this to my android test projected generated by the android sdk

(Some links are not displayed correctly because cant post more then two links with my reputition.)

Help is very appreciated :)

like image 761
Recek Avatar asked May 20 '14 18:05

Recek


1 Answers

I just had to solve this problem for myself, this is how I got it working:

1.) Install the performance Plugin 2.) In the project settings, add a new Post build action "Publish JUnit-testresults" 3.) As path, add /app/build/androidTest-results/connected/*.xml (Path may be slightly different on your machine)

4.) Now, after the project ran the first time, you have a new Link "Last testresult" and on the right side a graphical representation.

Regards

like image 106
Christian Avatar answered Oct 04 '22 10:10

Christian