How to execute selenium build using Jenkins?
1) Open Jenkins on browser (http://localhost:8080). Click on the 'New Item'.
Step 3: To run the Build --> Click on 'Build now' option.
Step 4: Check Build history and Console output and verify the output
We can execute selenium test cases in Jenkins by multiple ways. Please refer following screenshot where we can see multiple options to execute the build.
In this chapter, we will execute our test cases by using Windows batch command.
Step 1: First of all, you have to set the classpath and then to create a batch file. Please see the following instructions to do this.
1) Open your project structure. In my case it looks like below.
2) Open command prompt and set the classpath.
While setting classpath, we need to set the path of bin folder and libs folder (inside libs we have all libraries)
Home directory \> set classpath=C:\Users\Learn-automation\bin;C:\Users\Learn-automation\libs\*;
Note- Please make the changes as per your project structure
3) Open notepad and type the following command and save it as run.bat file
java -cp bin;libs/* org.testng.TestNG testng.xml
Step 2: Create a job in Jenkins to execute our build.1) Open Jenkins on browser (http://localhost:8080). Click on the 'New Item'.
3) Navigate to Advanced Project Options --> Click on checkbox 'Use custom workspace' --> Inside directory, we will specify the project home directory.
4) Add Build step --> Click on Execute Windows batch command.
5) Specify the batch file which we created and click on Apply and save.
Step 3: To run the Build --> Click on 'Build now' option.
Thanks for sharing this.
ReplyDeleteCan you please help me out that i never had a successful build.
ReplyDeleteAlways a failure build.
This comment has been removed by a blog administrator.
ReplyDelete