Robot Framework Jenkins

Jenkins offers a simple way to set up continuous integration and continuous delivery environment for almost any combination of languages and source code repositories. Today Jenkins is the leading open-source automation server with some 1,400 plugins to support the automation of all kinds of development tasks.

Continuous integration and continuous delivery of Java code (i.e., building projects, running tests, doing static code analysis, and deploying) are only one of many processes that people automate with Jenkins.

Continues Integration of Jenkins

The goal of Continues integration is to increase the bottom line in case of money and decreases the time and headache.

continues-integration

Jenkins is available as a Java 8 WAR archive and installer packages for the major operating systems, as source code and the source code is mostly Java. You can run the Jenkins WAR standalone or as a servlet in a Java application server such as Tomcat. In either case, it produces a web user interface and accepts calls to its REST API.

When you run Jenkins for the first time, it creates an administrative user with a long random password, which you can paste into its initial webpage to unlock the installation.

Web Elements of Robot Framework

Steps to Install Jenkins in Robot Framework

Before installing Jenkins war file first we need to install Java in our system. Navigate to Install Java Once you click on this link, you will be directed to the Java SE Development Kit 8 Downloads website. Under this website, you have Java SE Development Kit 8u231, While installing this software accept the license agreement for Java Oracle SE.

Depends on your windows configuration, download the file, I have windows 64 bit, so I am downloading the file. Once you have downloaded the .exe file, make everything as default while installing.

Once you click on the download button, the website asks you to Sign in to the Oracle account. If you don't have it, create an account by giving a valid username and password and verify your email id and then log in to the account and download the file.

Run the .exe file and click Next, so it will take a few minutes to install on your system.

installin-java-se-development-kit

Once you click on Next the Java software starts installing

installing-java

After installing you can verify, the java will be installed in the C drive under program files

java-is-downloaded-in-the c-drive

In order to verify whether the java is installed in your system or not, go to the command prompt and type Java versionIf it is installed successfully, the below message will be displayed.

verifying-java

If your system is not identifying the java version, then go to the system variables under environmental variables and add a new system variable. First copy the address of the java.exe file

location-of-java-file

Go to the system variable(This PC-->propeties-->advance system settings-->Environmental variables-->system variable-->New-->enter new variable name-->click ok) and set variable name as JAVA_HOME and variable value as C:Program FilesJavajdk1.8.0_231 and click on ok

set-up-system-varible

After this, if you run the command java -version in the command prompt, it will show the version



User Defined Keywords Using Python in Robot Framework

Installation of Jenkins War File in Robot Framework

The Web application ARchive (WAR) file version of Jenkins can be installed on any operating system or platform that supports Java. To download and run the WAR file version of Jenkins: Download the latest stable Jenkins WAR file to an appropriate directory on your machine.

Navigate to the Jenkins War File website, and you will find the different versions of the Jenkins war file, I am going to download the latest version of the war file which is present first in the list.

jenkins-war-files

Navigate to the location where Jenkins.war file has been downloaded and copies the address of the file, open the command prompt and navigate to the file location and run the below command to configure

Java  -jar “name of Jenkins.war” –httpPort=8086

configure-jenkins

When you run Jenkins for the first time, it creates an administrative user with a long random password, which you can paste into its initial webpage to unlock the installation, copy the below password as shown below.

passoword-to-proceed-further

Next step is, open the browser and navigate to the localhost:8086When I try to open the localhost:8086, the browser is not able to open it, so try with the localhost:8080, it will work.

The Unlock Jenkin page will be displayed as shown below

unlock-jenkin

Enter the password and click on Continue, the customize Jenkins page will be displayed, as shown below.

customize-jenkins-page

You have two options in the customize Jenkins, click on install suggested plugins and once you click on Install suggested plugins, it will start installing all the plugins

installing-all-the-plugins

Sometimes all the plugins have not installed, click on Retry to install all the plugins

retry-to-install-plugins

Once all the plugins have been installed, click on continue, Create First admin user page will open, enter required credentials and click on Save and Continue

create-first-user-admin-page

If the configuration is successful, then you can see the below message and then click on Save and Finish

instance-configuration

Now the Jenkin is ready to use

jenkin-is-ready-to-use

Web Services Automation in Robot Framework

Configuration of JDK with Jenkins in Robot Framework

You have successfully created the Jenkins, Click on start using Jenkins, the Jenkins Dashboard will be displayed, as shown below.

jenkins-welcome-page

Click on Manage Jenkins and select Global Tool Configuration, click on Add JDK and enter the System variable name and the java file location as shown in the below image and then click on Save

add-JDK-tool-kit

Again Go to Global Tool Configuration page and add Git, To find the git.exe file location, go to the program file and click on Git folder and then open bin, you will find the git.exe file, you can copy the file location and enter the global tool configuration as shown below.

git-file-location

Now, add the name as Default and the file location as shown below and then click on Apply and Save

add-git

We have successfully set up JDK and Git, and the next step is to set up Python. To set up python, select Configure System under Manage Jenkins.

To set up python, go to the environmental variable and click on path and then select edit you will find the python27 and python scriptslocation, copy the address path and save in the notepad.

find-the-location-of-python-and-python-scripts

Now, go to the configure system and scroll down and click on Environmental variable under Global Properties and click on add, the Name, and value as shown below

global-propertise

We have successfully set up Git, JDK, and Python; next, we have to install the Plugin.

Manual Testing Tools for API in Robot Framework

Creating Job in Jenkins with Robot Framework

We have successfully configured Jenkins, and now we have to create a Job, Open the Jenkins Dashboard and click on New Item.

click-on-new-item

Enter the Item Name RobotFrameworkwithGit and select Freestyle project shown below and then click on ok button.

enter-item-name-and-select-freestyle-project

Once you click ok, you are on the configuration pagefor this job. We have General, Sourcecode Management, Build Triggers, Build Environment, Build, and Post Build Actions. Enter the Description in the General as shown below.

configuration-page-of-job

Go to Source Code Management and select Git and then enter the URL of the Repository(Go to the Github account and open your Repository, you will get the URL of the repository)

URL-of-flight-applucation-repository

adding-respository-url-to-source-code-management

Select the Credentials below the Repository URL and select your credentials, which will be reflecting in the drop-down menu; if it is not reflecting, then click on Add and enter your Jenkins Username and password, as shown below.

adding-credentials-to-the-credentials-page

Once you click on Add in the credentials page, now it will be reflected in the drop-down menu, now select Ngendigital

creddentilas-reflection-in-drop-down

Now scroll down and click on Save and Apply.

Now, click on, it will go to my GitHub and get my Repository. Click on Build #1 and select Console output.

select-console-output

You can see that It has successfully gone to our GitHub and cloned our repository.

successfully-clonedour-repo

Click on configure under RobotFrameworkwithGit and then go to the Build. Select the Execute Windows batch command.I will ask us to enter the command to be executed. The command is present in the RobotFramworkwithGit in the C drive C:UsersUser.jenkinsworkspaceRobotFrameworkwithGit copy this link and pastes it in the command, as shown below.

entering-repository-address-path-in-the-command

Now enter the command to run through Jenkins, the command is a robot -t test_case_name test_suite

entering-oomand-to-run-test-cases

Before running the test case, go to Build Environment and select Delete workspace before build starts and then click on Apply and Save and then select Build Now, the test case will start executing. So this is how we are going to execute the test case without writing any codes over here.

Automation of REST API in Robot Framework

Installation of Robot Framework Jenkins

Till now, we have worked on the default plugins, which are present in the Jenkins, now let us install the robot framework plugins. Select Manage Plugins under Manage Jenkins

manage-plugins

If you click on available under manage plugins, you can see all the pluginsNow go back to the Jenkins and then select configure. Now select Post-build Actions and select Publish Robot Framework Test Results

publish-robot-framework-tets-results

We have to add the directory of the robot output, go to the RobotframeworkwithGit folder, you will find the log.html and XML files, so copy the address and paste it as shown below.

directory-path

Click on Save and Apply and then select Build Now, this will run the test case and verify it.

Installation of Selenium Library in Robot Framework

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions

Subscribe to See Videos

Subscribe to my Youtube channel for new videos : Subscribe Now