In today’s world of Agile/DevOps, the top priority for QA Engineers is to finish the thorough testing of the application under development within the sprint cycle itself. Not all QA professionals have access to commercially available automation tools (due to cost and other constraints) and hence, an open-source platform becomes the best choice to test the application within a very limited time.
In this article, I’m going to discuss how can we quickly get started with a popular open-source platform called Robot Framework which is purposefully used for acceptance level testing and acceptance test-driven development (ATDD), using an Eclipse based editor called Red Editor. So, let’s get started.
Few months ago, following an internal decision, our team was challenged to switch to an open-source automation tool from a licensed automation tool and develop the automated test suites from scratch. Considering several factors like our team structure, different technologies & platforms used, cross project reusability, and so on, we started exploring few open-source automation tools available in the market. We did few POCs as well & based on the results and efficiency of the tools, we had to finally choose the one that met most of the preidentified success criteria for the POC. So, the automation tool we finally zeroed on is none other than the Robot Framework.
There are various tools available for test automation in the market – it could be licensed or open-source. Robot Framework is simple, open-source, easy to use, powerful and is also easily extensible tool which utilizes the keyword driven testing approach. Robot framework helps us to automate the regression test cases in much lesser time and with greater efficiency, thus saving cost, faster go-to market time and enhancing the quality of the software product.
Why Robot framework?
At the end of the POC, Robot framework was found to satisfy almost all our business requirements. It’s a python based, extensible keyword-driven which can be implemented on all major platforms. So, one of the major challenges in our requirements was to have the multiplatform support fulfilled. Robot Framework is used for TDD, BDD and RPA. Robot Framework is also maintained/upgraded regularly by Nokia.
So, now as you know what is Robot framework, you might be having some questions! And let me answer!
- Where are the Robot Framework test cases stored? – HTML Files
- Can we create the Reusable Keywords from the library? – Yes
- Can we create the customized test libraries? – Yes, by using Python or Java
- Can we store the Regression test suite to any source control system? – Yes
- How to basically Integrate Robot Framework with CI/CD Systems? – Command Line Interface
- Can we create Data Driven test cases? – Yes
- Prevent some test cases from execution? – Use Tagging
After we finalized on the Robot Framework, we also finalized on the test editor to be used, that is RED Editor. This is an Eclipse based editor and I wanted to give a quick overview in the next section on its architecture and how to set it up in order to get started with developing and executing automation scripts.
Installation & setup of RED Editor:
Below are the few prerequisites/steps you can follow to install and configure RED Editor:
- Java 8 must be installed on PC and Environment variables must be set
- Install Eclipse EE Oxygen 3A Package
- Go to Eclipse Marketplace and Install RED editor
- Install Python 2.7.17 from below location
- Add Python 27 and Python 27 Scripts location to Path Environment Variable as shown below
- Check if Python is installed using python –version command in cmd prompt
- Use “pip install robotframework” command in cmd prompt to install robot framework
- Use “pip install robotframework-seleniumlibrary” command in cmd prompt to install Robot Selenium Library
- Use “pip install robotframework-openpyxllib” command in cmd prompt to install Openpyxllib for Excel Manipulation
- Go to Eclipse and navigate to File->New->Others->Robot Project and specify project name
- Once Project is created Navigate to red.xml, go to Library tab and Add Desired Libraries by Clicking on Add New Library File->C:\Python27\Lib\site-packages\SeleniumLibrary and Select __init__ file. Do the same for Openpyxl Library and Save file
Test Case creation:
RED editor is a text & table-based editor with code colouring, debugging, comment features. It has the keyword completion feature that shows the keywords that are found either from the test suite, resource files or libraries. You can simply type the starting letter of the keyword which in turn displays all the keywords starting with that letter (along with the arguments) which also makes this framework very easy to use, even for a test automation beginner to work with. Also, the arguments passed in the editor are validated automatically and displays the errors or warnings if there are any syntax errors. This feature works for built-in as well as for customised keywords.
Keywords and variables can be separately stored into resource file, so it can be then used in number of other test cases or test suites. It’s always a best practice to move the keywords to shared resource to enhance the reusability of the keywords which also avoids the duplication of works and saves the manual effort. Our team chose to save all the variables separately in the resource file.
Test Case execution:
We can execute the test case or test suite directly from the RED Editor. Test cases or test suites can be run in sequence, and the ordering can vary using the tags. With Robot Framework, whole execution of test suite takes only few hours.
Once the execution is completed, HTML report will be generated, and the report colour easily reveals whether the execution has been successful or not.
Summary Information in the report displays the overall status of the test execution, Start Time, End Time, Elapsed Time and the link to the log file.
If the Critical test cases are passed successfully, then regardless of the other test cases results, the report will be marked as OK. However, statistics will show the number of test cases failed if any.
If you want to further analyze the report, there is also a detailed log file generated with all actions, detailed description of the input and output parameters and keyword output with marked actions that went wrong.
Robot Framework also generates XML output file which can be used for further analysis.
How did Robot Framework help our automation process?
We have number of automated test suite that we execute to evaluate and validate the critical features of our software product every day. When we used to perform the manual testing for the same evaluation of the product accuracy after every single change made to the system, the effort was huge and cannot even compare the difference in the effort hours of Automation Vs Manual. So, with the help of automation using Robot Framework, we have been able to detect and track the issues easily on a daily basis & also with greater efficiency. Because debugging the issue is much faster and improves the value of the product and makes it market ready in lesser time.
Below table gives you an effort estimation for Automation Vs Manual:
In this article, we learnt about how to configure Robot Framework using RED editor to develop automation for our project. We also discussed about how to do the installation & setup in your system, how to create and execute the test cases/Suites. And then we quickly got an insight through the Test Report that the tool finally generates evaluating the features of the software for any bugs.
Now that, you have the good ground level information, it is time for all of you to learn more about this Framework on how this can be leveraged with different platforms, technologies involved in your project; which enables you to develop your automated tests and be aware of the tool capabilities to work with.
I hope you found this article helpful. Let me know if you would like to discuss further if you have any questions or suggestions around this topic.
Thank you for your time reading through this article.