Contents:
To get the project, you can either download and extract the latest package from the GitHub or checkout the source code directly. As a result you get **RobotFramework** directory with several files.Example test cases, test library used by a robo project, and generated results are available also online. Therefore, you do not need to download the project if you are not interested in running it yourself.
This project contains the below test cases1. Login into a website
2. Verifying Input Box
3. Selecting Radio buttons and Checking/Unchecking of Checkboxes
4. Selecting Drop Down values
5. Using Implicit wait keyword **set selenium implicit wait** for a Registration Page on a website
6. Command to run only test cases with Tag regression
robot --include=regression .\TestCases\CredentialTest.robot
Command to exclude test cases with Tag regression
robot -e regression .\TestCases\Credentials.robot
Command to run test cases with both Tags i.e sanity and regression
robot -i sanity -i regression .\TestCases\Credentials.robot
- Reading data from a complex Json file and passing the same onto a website
Import the DebugLibrary.py file present in this project root folder into your test case
Use Suite Tear down keyword and a keyword Teardown Actions as shown below
Make sure to include the set breakpoint in your test case to activate the Python Debugger (Pdb)
Use the below command in the terminal, to run the test cases in Debug Mode
$Env:ROBOT_DEBUG = 'TRUE'; robot .\TestCases\ReadingDataFromJson.robot
Set the value of the variable to the desired value at run time
BuiltIn().set_local_variable("{firstName}", "Superman")
In order to get the value of the variables during run time use below command in Pdb
BuiltIn().get_variable_value("${firstName}")
Screen-shot of how the value will look like after runtime modification of the variable
When pause for debug keyword is used , we get to see the below pop-up, where the execution gets stopped
robot .\TestCases\Credentials.robot > results/console-output.txt
The above will create a txt log file which has all the contents of Log to Console key word present in your test case into a results directly
robot --output original.xml tests # first execute all tests
robot --rerunfailed original.xml --output rerun.xml tests # then re-execute failing
rebot --merge original.xml rerun.xml # finally merge results
FirstReport.html
Firstlog.html
ReportWithFailures.html
LogWithFailures.html
A precondition for running the tests is having Robot Framework installed. It is most commonly used on Python but it works also with Jython (JVM) and IronPython (.NET). Robot Framework installation instructions cover installation procedure in detail. People already familiar with installing Python packages and having pip package manager installed, can simply run the following command:
pip install robotframework
Robot Framework 3.0 and newer support Python 3 in addition to Python 2.