From the course: Robot Framework Test Automation: Level 1 (Selenium)

Unlock this course with a free trial

Join today to access over 24,800 courses taught by industry experts.

Adding setup and tear down

Adding setup and tear down

In this video, we're going to utilize the Robot Framework setup and teardown mechanism, specifically test setup and test teardown, suite setup and teardown are also available, to allow you to do things before and after your entire suite runs. But for this example, I'm only going to use test setup and teardown. Why do we want to do this? Because then we don't have to specify in our test cases to open and close the browser, and we'll have one script block to easily handle any test related setup. The really important thing about utilizing test teardown is that the browser will close even if an exception occurs. What we discussed in a previous video was that the way things currently are, if one of our test steps fails, Robot Framework will skip the rest of the steps of that test case and the browser will never be closed. If we place it within a test teardown, that browser will always be closed. So how do we do it? First, we add the Selenium2Library to Common.robot, which we've already…

Contents