Integrate Automation framework with Build using Jenkins.
‘Jenkins’ is a tool which is used for continuous integration testing.
Please follow the below steps to configure the Jenkins with your Automation Framework-
Step1- click on this link :http://jenkins-ci.org/
Step2- click on ‘Long term support release’ tab which is there in right side.
Step3- click on ‘older but stable’ then one pop-up will come to save the file & there in pop-up click ‘OK’ which will save Jenkins the war file in the Downloads folder, copy paste the downloaded file inside the project.
Step4- Open the command prompt (cmd) and go to project directory.
For ex– say your project directory is -> C:\selenium\SpiceJet\Owler
so here you open cmd, then give command as cd C:\selenium\SpiceJet\Owler and hit enter
Step5- Then type the command ‘java –jar jenkins.war’ & hit enter.
Step6- If Jenkins server is loaded successfully it will display following message in command prompt. Jenkins is fully up and running
Step7- Now open the browser & enter the following URL in the address bar “local host:8080” which will display homepage of the Jenkins server.
Step8- Click on New Job & specify the job name
For ex: AutomationFramework
Step9- Select the first radio button ‘Build a free-style software project’ then click on OK.
Step10- Click on ‘Advanced’ & select last checkbox ‘use custom workspace’ under ‘Advanced Project options’ section.
Step11- Type the java project path in the directory (For ex– the java project path –
Step12- Go down, There you will find Build section, there click on ‘Add Build Step’ & select ‘Execute Windows Batch Command’ & type ‘RunMe.bat’ in the command field.
**How to create RunMe.bat file –
a) open notepad
b) paste this command- java -cp bin;jars/* org.testng.TestNG testng.xml
c) save the file as RunMe.bat
Step13- Go down and click on Save button.
Step14- Now you are all set to use Jenkins. Click on Build Now. It will start the execution of your framework.
Note- In order to create a Build, Developer clicks on ‘Build Now’ which will start the Build creation process once the build is created it will start Framework execution automatically. Every time when we run the build, Jenkins will display a link under Build History, the name of the link will be current system Date & Time, when we click that link it will take us to Build details page where if we click on ‘Console output’ link it will display output of the Automation Framework which is printed on the command prompt.
Please find snapshot below, where you should put .bat file and jenkins.war