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

Demo

To kick things off, I thought it would be great to show you a demo of just what this tool can do. So what we're going to do is we're going to run some tests which include API tests, File System tests, Website, Database, both SQL Server and MySql, and also a brief XML test. And then we're going to examine the amazing results file, which is one of the big reasons why I think Robot Framework is the best tool to use. So let's jump in. In this course, I'm going to be using the Pycharm IDE to develop and run my tests. So as you can see, I've got a project open here with API tests, files, MySql, SQL Server Web tests and XML tests. And this gives you a general idea of the look and feel of tests. You can see I've got some resources that my test needs. I've got test set up and test teardown, I've got some variables and then I've got the tests themselves, which are very pleasant to look at keyword format. I also have a terminal window down here that allows us to easily run the tests. So let's go ahead and do it. So you can see we've gotten to the Web tests now and it's going to do two different tests. And when it's done, it closes the browser. Okay. So that series of tests is done and my results are stored here in this log file. Before we look at the log file, though, I want to show you just how easy it is to switch browsers. I'm going to change this to say, Chrome instead of IE. And now what I'm going to do is I'm going to run only these two test cases instead of the entire suite by specifying this tag. So I use my up arrow to bring back my command. I move back a little bit and I use -i to include the keyword web, and then I hit "Return." And now you can see that only the web tests are running and they're running in the Chrome browser. So that's how easy Robot Framework makes it to be able to switch to different browsers. And you can do that in the command line as well. And now, as you can see, it's finishing up its final test case. Unfortunately, this test case failed. So what I can do now is drill in real quick to this results file I told you about and show you how impressive it is. So when a test case does fail, logged out user can add product to Cart. The results file opens right up to that failure and says the text Cart subtotal did not appear in five seconds, and it automatically embeds a screenshot right into your results file. So it's telling me to Cart subtotal did not appear. We can see that order subtotal instead of Cart subtotal. So it's a simple change we can make by drilling into Resources, Web, Page Objects, Cart, and changing this from cart subtotal to order subtotal and running the tests again. So I've really run it in the background and you can see all my tests have parsed. So let's go take a look at that results file and see what it looks like when I run all of these suites. If I start with the report file here, I can open a browser and notice the entire file is green. It gives me a bunch of interesting statistics and a summary of all my test cases. And down here I have tags where I can select certain tags to see those results. So I can see only the files if I want to or only the XML if I want to. I can jump over to suites and I can filter by different suites of results that I want to see. And I can even jump into "Search" here and type in various search terms and filter my results by tag, for instance. Now, the cool part comes when I click on this log button over here, or I'd just go ahead and open up that log file using open and browser. In this file I get the same global statistics up at the top, but the really good part comes down here where each of the suites is displayed in a tree format. And if I click on these pluses and expand the trees, I can see the various test cases that were run in any given suite. And when I drill down further, I can see the user defined keywords that are part of the test case. And when I drill down even further, I can see the Robot Framework keywords for the particular library I used and drilling down even further, I can see the input information that was applied to those keywords. So all in all, you can see that the Robot Framework results file is very attractive and powerful.

Contents