Labels: automation-testing , continuous integration , implementation , installation , java , jenkins , linux ,selenium , testing
Jenkins is a multi-purpose Continuous Integration server.
In this post, we will install Jenkins on a Linux machine (Ubuntu / Debian Distro) and we will configure it to run a selenium project. The same principal applies to Windows operating system.
How to run a selenium java project using Jenkins on Linux?
The steps are as follows:
1. Install Jenkins on Linux machine
2. Make your Selenium Java project into a Maven Selenium Java project
3. Configure Jenkins to run Selenium project
Step 1. Install Jenkins on Linux machine
The simple way to install Jenkins on Linux (an ubuntu machine) is installing it from commandline (terminal in Ubuntu):
After you install it this way you can manage Jenkins via the terminal as follows:
You can visit http://localhost:8080 to see whether you can access Jenkins via the web browser
Step 2 . Make your Selenium Java project into a Maven Selenium Java project
I have created my sample Selenium Google Search project which was implemented in Java using TestNG into a Maven project
A sample project is here : Sample Selenium Java project which uses maven
Step 3. Configure Jenkins to run Selenium project
This step has further steps:
1. Install Java and Maven so that Jenkins can use them
Visit http://localhost:8080/configure
If you choose the install automatically checkbox, Jenkins installs the required Java and Maven installations for you.
2. Tell Jenkins where is your project
In Jenkins, create a new project and select Maven Project.
After this step, you need to tell Jenkins where is your project on your local machine.
Before this step make sure you have given suitable rights to your root project directory using chmod command.
If you are using a custom workplace, you will need to Configure Jenkins as shown here.
3. Run your project using the build now option in Jenkins
You will get some issues as follows:
1. Cannot access pom files - This issue is due to lack of proper access rights
2. Cannot open display (error while running jenkins on linux machine)
How to solve Cannot open display in jenkins/hudson in Linux machine?
The solution is simple.
Open jenkins shell script located at: /etc/init.d/jenkins
Add the following lines as follows before PATH variable:
##Hack by Sundeep##
/usr/bin/X :0 vt7 -ac
export DISPLAY=:0
xhost +
In this post, we will install Jenkins on a Linux machine (Ubuntu / Debian Distro) and we will configure it to run a selenium project. The same principal applies to Windows operating system.
How to run a selenium java project using Jenkins on Linux?
The steps are as follows:
1. Install Jenkins on Linux machine
2. Make your Selenium Java project into a Maven Selenium Java project
3. Configure Jenkins to run Selenium project
Step 1. Install Jenkins on Linux machine
The simple way to install Jenkins on Linux (an ubuntu machine) is installing it from commandline (terminal in Ubuntu):
You can visit http://localhost:8080 to see whether you can access Jenkins via the web browser
Step 2 . Make your Selenium Java project into a Maven Selenium Java project
I have created my sample Selenium Google Search project which was implemented in Java using TestNG into a Maven project
A sample project is here : Sample Selenium Java project which uses maven
Step 3. Configure Jenkins to run Selenium project
This step has further steps:
1. Install Java and Maven so that Jenkins can use them
Visit http://localhost:8080/configure
Install Java and Maven for Jenkins(click to enlarge) |
2. Tell Jenkins where is your project
In Jenkins, create a new project and select Maven Project.
After this step, you need to tell Jenkins where is your project on your local machine.
Before this step make sure you have given suitable rights to your root project directory using chmod command.
If you are using a custom workplace, you will need to Configure Jenkins as shown here.
3. Run your project using the build now option in Jenkins
You will get some issues as follows:
1. Cannot access pom files - This issue is due to lack of proper access rights
2. Cannot open display (error while running jenkins on linux machine)
How to solve Cannot open display in jenkins/hudson in Linux machine?
The solution is simple.
Open jenkins shell script located at: /etc/init.d/jenkins
Add the following lines as follows before PATH variable:
##Hack by Sundeep##
/usr/bin/X :0 vt7 -ac
export DISPLAY=:0
xhost +