Selenium Scripts Integration with Jenkins

So this is my first tech blog!….haha…. Fingers crossed…. Here we go!

****************************************************************************************************************************************

There are many ways to trigger Selenium automation scripts which are collated into a test-suite. The method I have employed is as follows :-

1.’Mavenise the Project’ – I created a new Maven Project in my eclipse setup and copied all my automation scripts into the src/test/java/.

2.I create a ‘testng.xml‘ file which consists of the various tests I want to run as part of the test suite.

3.I resolve all the dependencies on my Maven Project using ‘mvn dependency:tree’.

4.In the pom.xml file , I give the name of this xml file.

5.I also enter various plugins needed for execution,report generation etc in the pom.xml file.

6.One such plugin is the maven-site-plugin. For more info goto http://maven.apache.org/plugins/maven-site-plugin/

7.Another plugin I use is the maven-surefire-plugin.  For more info goto http://maven.apache.org/surefire/maven-surefire-plugin/

8.Finally to run the test-suite I run the ‘mvn site’ command from the folder root directory.

9.The test-suite gets executed and the surefire report is generated in **/target/site/surefire-report.html

There are other ways of running test-suites as well like ant scripts etc, but I personally find this the easiest way to trigger a test automation suite and get a nice meaning report at the end of it! The surefire-report.html generated in the target/site folder is awesome!

Now if you want to run this test-suite as a part of a Continous Integration process using Jenkins you can do the following :-

1.Create a new Jenkins job (Select Maven Project).

2.Give the destination of the pom.xml file ( relative to the node root).

3.In the goals section enter ‘site’.

4.On building the project, you have your automation scripts running.

5.Next step is to append the surefire-report into the main Jenkins notification email.

All the best with whatever IT is that you are doing ( which redirected you here 🙂 )

Regards,

VJ

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s