Sunday, January 19, 2020

Configure Continuous Integration System Jenkins to build Robot projects

1. Download Jenkins

Go to https://jenkins.io/download/ and download it for your system.

2. Start and Setup Jenkins in you system

After download open command line window.

Write from command line
cd location_of_jenkins.war_file

Write from command line to run Jenkins in 8080 port
java -jar jenkins.war

Write from command line to run Jenkins in a specific port
java -jar jenkins.war --httpPort=port_number

Output will show Jenkins running status.

From browser, browse to localhost:specific_port_number (if specific port is given otherwise only localhost which will select port 8080 by default).

3. Add plugins and start

When Jenkins start select plugins and setup them after that restart Jenkins. Make sure Robot Framework plugin is installed.

4. Create and configure a new job in Jenkins

Select a Freestyle project and click on OK button. Enter Description from General tab. Select Git in Source Code Management tab, provide Repository URL and test it. In Build tab select Execute Windows batch command if you are running in Windows. Provide commands in Command box and Save it.

Windows batch command
robot_project_folder_location_drive:
cd robot_project_folder_location
robot -t test_name test_suite_name
echo BuildCompleted

5. Build - Robot Framework

From Jenkins project, select Build Now from drop down list, automation script should run when Robot project is building. Also robot reports should be available after successful build.

6. Robot Framework Reports

From Jenkins project configuration and navigate to Post Build Actions tab, click on Add post-build action button drop down list select Publish Robot Framework test results. Than provide location of robot test results file location in Directory of Robot Framework test results field and Save it. Build again to validate robot test results.

7. To overcome Opening Robot Framework report failed error in HTML reports

Search for Jenkins security policy. Go to JENKINS wiki/Configuring Content Security Policy navigate to Implementation section and copy code given in Unset the header: section. Than move to Jenkins > Manage Jenkins > Script Console > Paste copied code and click on Run button. If Result shown below than it is successful. Build again and click on robot results html links and observe that instead of error reports are shown.

No comments:

Post a Comment