Robotium Integration with Jenkins

robotium logo-title

 

 

 

 

 

 

Robotium Android Testing Platform can be integrated with Jenkins which makes Mobile Automation a step forward .

Step By Step Instructions For Integration with Jenkins:

Step 1:

Deploy Jenkins in server.

Download Jenkins from the website : http://jenkins-ci.org/
Download the war build of Jenkins and deploy it in the server to make start with Jenkins.
If we are using Apache Tomcat then just paste the Jenkins.war file in /webapps directory of Tomcat home location. After this just go to /bin and click on the bat file “startup.bat” , This will start deploying Jenkins.war in the server and after getting server started successfully if deployed in  local machine then navigate to localhost:8080/Jenkins on your Browser .

Step 2:

Install Necessary Plug ins:

On the Dashboard of Jenkins click on ‘Manage Jenkins’ from the left side navigation menu.  Then click on ‘manage plugins’.
From the tabs click on ‘Available’ and search for ‘Android Emulator Plugin’ and install it. As Robotium test project is solely based on Android libraries and we need an android emulator to run the test scripts of Robotium so ‘Android Emulator Plugin’ is necessary.

If we are going to add projects from SVN repository then “Subversion” plugin needs to be installed.

Another plugin called “Green Balls” can be installed so that it will replace the default blue ball indicator for successful builds.
Step 3:

Add a new job from Jenkins Dashboard.

Go back to Jenkins Dashboard and click on ‘New Job’ from the left navigation menu items. It navigates to a page asking to choose project type and give a name to the job.

Give a name of the job in the ‘Job name’ field and choose ‘build a maven2/3 project’ as we have already converted our project to Maven project and plugin for maven support comes as a part of installation of Jenkins, If not so then install maven plugin also.

Click on ‘Ok’

As we are going to add our maven project from SVN, so in the next page under ‘source code management’ select subversion and provide the Repository URL. There are some other options  in that page to choose , fill them up according to the necessity.

Click on ‘Apply’ and ‘Save’. Every time we need to change the configuration click on ‘configure’ link in the left navigation page.

Step 4:

Provide Pre steps and Post steps.

Pre steps will be executed before the build starts and post steps will be executed after the build, But any failure in pre steps and post steps will show Build as failure.

We have to give windows batch commands to run the test scripts on the device or emulator.
From ‘Add post build steps’ drop down select ‘Execute Windows batch Command’ and add the command that we usually use to run the test scripts from the command prompt.

e.g “

adb -d shell am instrument -w -e reportDir sdcard com.hellodemo.test.test.test/com.zutubi.android.junitreport.JUnitReportTestRunner”

Step 5:

If we need to pull any file from device or emulator e.g Reports , we can specify another windows batch command to pull those files to the specified location in the command.

e.g  “adb -d pull sdcard/junit-report.xml D:android_javaXml2Htmlreport”

Note: Please ensure the APK file of your test scripts has already been installed with the device or emulator, otherwise you need to install it using adb install command or the same can be provided in the pre build steps in the Jenkins configuration of your project.