Friday, 15 March 2013

Robotium - Jenkins -Testlink Integration




Converting Robotium as Maven Project

We can run robotium tests directly from jenkins, but to integrate it with testlink, better we can convert it into Maven project.

To convert robotium as maven project, make sure that your eclipse has Maven-Android plugin.

Step - 1:


Upload your existing robotium project into eclipse, Create a pom.xml file and add required dependencies. (Including your source project)

Step - 2 :

Right click the project and convert it as maven project.

Step - 3:

Now you can run robotium tests by,

mvn clean install

Step - 4:

Create a custom field " Java Class " and assign it your testlink project.

Enter the test project package name in the custom field.



Step - 5:

Create a jenkins job and configure the following properties,



 



Step - 6 :

You can now build the job it will automatically update the testlink testcase and will attach junit test report with the testcase.

Note: 

Here, i have specified my project name and package (com.example.calculator.test). modify this according to your project name. 
deploy your android project to your local maven repository.

[ To deploy the apk file into maven repository, you can use 
mvn install:install-file -Dfile=  -DgroupId=com.example.calculator -DartifactId=Calculator -Dversion=1.0 -Dpackaging=apk ] 

In maven command  specify the local m2 repository path, so that jenkins will look into local repository for android application. Otherwise it will browse global repository.

Converting Android as Maven Project


Now we can create / convert android projects as maven projects by using Maven-Android-Plugin. With the following simple steps you can convert android project as maven project.

Step -1:


 In your eclipse  install Maven-Android Plugin from eclipse market place. search m2e android and install it.

Step -2:

Create a pom.xml file in your project root directory and add required dependencies.

Step - 3:

Right click your project configure->Convert to maven project.

Step - 4:

Now you can build your project from terminal by using the command 

mvn clean install 

to deploy the android apk file into adb device run,

mvn android:deploy

and to run the application use,

mvn android:run

Your project structure should look like this,

 

 

 

Note: - In pom file change groupId, artifactId and version according to your project and package name.