‘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 –
C:\selenium\SpiceJet\Owler)
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
Please leave your valuable feedback. Thanks!!
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 –
C:\selenium\SpiceJet\Owler)
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
Please leave your valuable feedback. Thanks!!
Hi Sanjay,
ReplyDeleteNot sure how relevant is my question. At my office, Dev use Microsoft VSTS ALM automated build deployment. So, just want to know whether this can be used here?
really nice one. and u explained step by step. thanks alot.
ReplyDeleteHi Sanjay,
ReplyDeleteThanks for you blog....
I'm getting the Error while executing the Build now...
I saved the RunMe.bat in the Project Folder itself.
Error:
C:\Thyagu\Workspace\"projectName">java -cp bin;jars/* org.testng.TestNG testng.xml
java.lang.NoClassDefFoundError: org/testng/TestNG
Caused by: java.lang.ClassNotFoundException: org.testng.TestNG
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: org.testng.TestNG. Program will exit.
Exception in thread "main" Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE
Please give the full class name preceding with the package name in testng.xml
Deleteex- say ur package name is testCase and class name is Test1 then in xml give like-
This comment has been removed by a blog administrator.
ReplyDeleteHi Sanjay,
ReplyDeleteIn my system Jenkin server is loaded successfully but when i'm trying to open homepage of the jenking server ,getting following error:
Unable to connect
"Firefox can't establish a connection to the server at localhost:8080."
Hello Amrita,
ReplyDeletePlease 1st open cmd, there give the command to run jenkins
then try to open localhost:8080 in FF.