This article will discuss the robot framework and run our first selenium test. Robot Framework is a generic test automation framework for acceptance testing and acceptance test-driven development (ATDD).
It is a keyword-driven testing framework that uses plain-text syntax and is easy to learn, even for non-programmers. Robot Framework and Selenium make a powerful combination for web testing.
The Robot Framework SeleniumLibrary is a Selenium-based library for Robot Framework that provides keywords for web testing. The Selenium Library allows Robot Framework to interact with web pages through a web browser and automate tasks such as clicking buttons, filling out forms, and verifying web page content.
Open cmd and note that we must have python installed here with pip.
pip install robotframework==3.2
- Install the robot framework from cmd, and the version must be 3.2, and the RED robot editor for eclipse only supports robot framework 3.2
- We won't find the RED robot editor in the eclipse marketplace.
- Click Help -> Eclipse Marketplace -> and type into Find field "RED" Update Site: Click Help -> Install New Software -> Add and set address in Location to:
- Follow the instructions and install.
Click on the new project and hit robot project in eclipse.
It should create folders like this.
3.) Working Example.
- Right-click the project and create a new folder with the preferred name.
- Right-click the folder and hit on the new robot test suite.
- This will create a new test suite where we can run our code.
*** Settings *** Library SeleniumLibrary *** Test Cases *** MyFirstTest Open Browser https://programsbuzz.com/user/login Input Text id=edit-name naruto Close Browser
- This is what the code for running a test looks like.
Type in settings and hit ctrl+space, and select settings.
Type in library and choose selenium library to import selenium.
- Below the test cases, we name our test as MyFirstTest.
Open browser will open firefox by default and give the address url next to it will launch the site.
Input Text is the sendeys of robot framework.
- We can see the test has passed. We can also view the reports from here.
- This is how we work with the robot framework.