How is Robot Framework different from Selenium?
- A question that comes up a lot when I talk about Robot Framework is why should I use a Robot Framework versus Selenium? Well, that's not really a valid question because Robot Framework in a sense is Selenium because it's an abstraction layer or a wrapper on top of Selenium. You can see here that I have this script .robot file at the top, and it is capable of interacting with any of these libraries shown below. So if you decide your script wants to do Selenium testing, you simply load up that Selenium2 library that's highlighted in yellow, and start writing simple keywords to create your script.
So let's see a specific example of this. This is a typical Selenium test, and you can see up there at the top we've added a bunch of using statements that bring features into the file that we're trying to work with. Then we've got name space, and we've got a class, and then we have a main function, and then a bunch of C sharp code here where we're newing up variables and using C sharp syntax to spin up a new Firefox web driver and we're going to navigate it to bing. And maximize the window. We're going to identify an input field. We're going to type in some keys.
And then we're going to hit the enter key to submit that search. And then we're going to close the window. Now what's interesting about this is that in order to use different browsers, you'd have to bring in a different using statement for a different web driver, and then the test you'd have to specify somehow which web driver you'd want to use in some kind of a selection statement here. So you can see for a QA person who doesn't have any existing programming skills, this is a pretty steep learning curve. By contrast, this is what a Robot Framework web test looks like. You can see at the top here I have one line that says I want to bring in the Selenium2 library.
Then I create the name of my test case. There's no classes or name spaces or anything like that. Just the name of my test case. And then the beginning of each of these lines is a Selenium2 keyword. So I can say open the browser and I can pass in two different pieces of information to that. And I could say wait until page contains and pass in what I'm waiting for. Then use input text to pass in the locator and what I want to input. And click a button, I pass in the locator to click that button. And sleep here. I just have that in there to keep the window open so we can see it.
And then finally close browser. So at it's simplest, you can see that Robot Framework is a very easy keyword driven language to use. Taking it a step further, we can see what a more formal example looks like. And in this example, I'm comparing it to Cucumber which uses the Gherkin syntax. So you can see we have a little bit more up top here. Including my documentation. I'm adding in two resources that these test cases depend on. I've got test setup and test teardown. And then each of my test cases. And you can see here I'm using the Gherkin syntax given user's not logged in, when the user searches for products, then search results contains relevant products.
So Robot Framework can do Gherkin similarly to the way Cucumber can. So hopefully you can see here that by using Robot Framework you can produce very easy to read test cases very easily and you can test a wide variety of things instead of just web like Selenium does.
- What's a test automation framework?
- Robot Framework vs. Selenium
- Creating and running your first script
- Options for running scripts, including PyCharm and Jenkins
- Making a script more readable
- Using variables to centralize data
- Incorporating the Page Object Model
- Robot Framework libraries
Skill Level Intermediate
F#: Automated Testing for Developerswith Kit Eason2h 33m Intermediate
Effective Android Testing for Mobile Developerswith Chiu-Ki Chan2h 56m Intermediate
Python Automation and Testingwith Bhoomika Agarwal1h 16m Intermediate
1. Installation Overview and Preconditions
Installation overview2m 25s
2. Windows 10 Installation
3. Creating Your First Script
4. Script Running Options
5. Make the Script More Readable
6. Use Variables to Centralize Data
7. Semantic Sugar
8. Challenge: Create a Test Suite from Start to Finish
9. Exploring the Robot Framework Libraries
Next steps3m 9s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.