Plug: Robot Framework is quick to setup, easy to write tests for, and super fast to triage failures in.
The last point really sets it apart from all other frameworks, where no other test framework seems to have screenshots, test steps executed and every variable assigned in the results output file. You can also switch seamlessly between Robot commands and Python in tests. It's a dream.
Here's a quick Proof of Concept / Hello World
*These instructions assume a Unix based os.
Setup:
Protip: Use virtual envs to manage your python environments. Google what this means if you need more help as I won't go in to this here.
Pre-Requisites
virtualenv
python 3.x
pip
Install Instructions
pip install robotframework
pip install robotframework-selenium2library
And we want a chromedriver to run some tests, so I went for this one:
pip install chromedriver_installer --install-option="--chromedriver-version=2.46" --install-option="--chromedriver-checksums=e287cfb628fbd9f6092ddd0353cbddaf,f63b50301dbce2335cdd442642d7efa0,d498f2bb7a14216b235f122a615df07a"
If you want good test structure you should have Models, Keywords and Tests folders. The contents of each should represent page objects (Models), a set of actions you can perform on these (Keywords) and then the actual Tests you are executing (in the Tests folder).
I've created some Keywords which are useful to have:
Keywords/test-completion-steps.robot
*** Settings ***
Library Selenium2Library
*** Keywords ***
Complete Test Actions
Log Test execution completed
Run Keyword If Test Failed Complete Failed Test Actions
Close All Browsers
Complete Failed Test Actions
Log Source
Log Location
Log Title
Capture Page Screenshot
Get Window Titles
And I've created a Test just to run something
Tests/matts-test.robot
*** Settings ***
Library Selenium2Library
Resource ../Keywords/test-completion-steps.robot
Test Teardown RunKeywords Complete Test Actions
*** Test Cases ***
Lets Test Google Works
Create Webdriver Chrome
Go To http://google.com
Input Text xpath=//input[@name='q'] Test Level Up Blogger
Submit Form
Wait Until Element Is Visible xpath=//div[contains(text(), 'About') and contains(text(), 'results')]
Finally, run it!
type
robot Tests/
A blog following the arduous journey along test paths and details of the interesting, bizarre and inane encountered en route.
Subscribe to:
Post Comments (Atom)
Robot Framework, Basic Setup
Plug: Robot Framework is quick to setup, easy to write tests for, and super fast to triage failures in. The last point really sets it apart...
-
So, {} represents a dictionary, e.g. {'key': value} and we can get a value out of a Robot Framework dictionary via ${dictionar...
-
For those short on time the most significant material is in black . Elaborated this becomes Hewlett Packard’s Quality Centre eleven ...
-
The art of testing lies in the ability to put the right checks in the right places to provide the right people with information at the right...
No comments:
Post a Comment