Monday, January 27, 2020

Different types of Waits in Robot Framework (Selenium Library)

1. Sleep
Waits for a specific given time.

2. Set Selenium Speed
Waits given specific time before each Selenium actions performed.

3. Set Selenium Timeout
Waits given specific time before throwing exception for each Selenium Waits.


4. Set Selenium Implicit Wait
Waits given specific time before throwing exception for each Selenium action's locator not found (only when locator is not found, if found it will wait default time).

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.

Configure Version Control System Git in Eclipse for Robot projects

1. Create an account in Github

Go to https://github.com/ signup for an account. If you already have account than sign in.

2. Sign in and create a new repository

Create a new repository for your Robot project and remember the repository URI.

3. Git Perspective in Eclipse

Open Eclipse and navigate to Window -> Open Perspective -> Git.

4. Clone Repository in Eclipse

From Git Repository select Clone Repository, provide git repository URI and credential information in Source Repository window. Specify Branch and save it.

5. Share Project in Eclipse

In Eclipse, navigate to Project > Team > Share Project and share newly added repository.

6. Commit and Push from Eclipse

In Eclipse from Git Perspective select files for Staging, provide commit message and click on Commit and Push button.