Tuesday, January 24, 2012

Integrating Selenium with jenkins/Hudson


 
Integrating Selenium with Jenkins
Jenkins is a build server designed for Java. Jenkins is responsible for checking if your application needs building, building it, triggering any testing that you have defined and, finally, reporting on the state of the build. Jenkins is easily available and can display JUnit reports in graphical format with drilldown capabilities.
Download Jenkins
Download Jenkins war from Jenkins website. Save it in one of our drive. For ex: D:\Jenkins.war
Start Jenkins:
Open command prompt and navigate to the folder containing jenkins.war and give java –jar jenkins.war
You can see
[Winstone 2012/01/25 08:46:47] - Beginning extraction from war file
Jenkins home directory: C:\Users\username\.jenkins found at: $user.home/.jenkins
[Winstone 2012/01/25 08:46:52] - HTTP Listener started: port=8080
[Winstone 2012/01/25 08:46:52] - AJP13 Listener started: port=8009
[Winstone 2012/01/25 08:46:52] - Winstone Servlet Engine v0.9.10 running: contro
lPort=disabled
Jan 25, 2012 8:46:52 AM jenkins.model.Jenkins$6 onAttained
INFO: Started initialization
Jan 25, 2012 8:46:53 AM jenkins.model.Jenkins$6 onAttained
INFO: Listed all plugins
Jan 25, 2012 8:47:25 AM jenkins.model.Jenkins$6 onAttained
INFO: Prepared all plugins
Jan 25, 2012 8:47:26 AM jenkins.model.Jenkins$6 onAttained
INFO: Started all plugins
Jan 25, 2012 8:47:26 AM jenkins.model.Jenkins$6 onAttained
INFO: Augmented all extensions
Jan 25, 2012 8:47:34 AM jenkins.model.Jenkins$6 onAttained
INFO: Loaded all jobs
Jan 25, 2012 8:47:34 AM jenkins.model.Jenkins$6 onAttained
INFO: Completed initialization
Jan 25, 2012 8:47:34 AM hudson.TcpSlaveAgentListener <init>
INFO: JNLP slave agent listener started on TCP port 64776

Jenkins  home directory will be created in C:\Users\username\.jenkins
Check to see, if Jenkins is running
Jenkins will be launched on port 8080, hence, open the URL http://localhost:8080/, to see the dashboard of Jenkins
You can see,




Create new project
1.       Enter job name as SelAutomationCI
2.       Select “build a free style software project”
3.       Click OK
Enter the details of repository
4.       In the Source code management section, select the repository type and enter the repository location.




Integrating Selenium with Jenkins:
1.       In the Build Section, there are 4 options through which you can integrate your projects to selenium
2.       In my project, I use ant as building tool which can run suite. (Check the blog, http://seleniumready.blogspot.in/2012/10/sample-ant-script-for-running-targets.html )
3.       In build Option->Add build step, we need to select invoke ant CItarget



 
1.       In the targets section, write the target which runs the suite. In our case: run
2.       Click on Advanced.
3.       Enter the  build file location in Build File field






1.       In Post Build action section, Click on  Publish junit test results report and enter the location to store the results xml’s, as shown below.
2.       Click on Email notification, to get the result of unstable builds, or build failure.
3.       Click on Save.
4.       To run the build, Click on build now.





1.       the build History section, You can see the build number with the time stamp.






.       Clicking on the build link, will show the console output.
.       You can see selenium test running on Hudson.

No comments:

Post a Comment