Is test automation easy? Should be with Robot Framework and Replit

Milan Novovic
5 min readJun 3, 2021

Recently I was attending web conference where speakers discussed should testers learn programming and what implication does it have if testers are lacking those skills. They all converged around idea that everyone should have some programming skills, or at least to be able to write scripts that will ease their lives when it comes to automating everyday repeating tasks.

Question is, where do you start your leaning process with above idea on your mind?

JavaScript is becoming more popular among the test automation engineers because of Cypress, most examples you can find are already written in Java and Selenium, and Python is of course easiest to learn for newcomers.

But languages are just one part of the equation when it comes to automating test cases. The biggest obstacle, is of course, once you or your company is going for certain tech stack, where to go next?

Do you start writing your own framework in the language of your choice?

Well, you might or, maybe you can have slightly different approach.

First you start with simple script that is written in keyword driven style, so you understand what each keyword does when running the script. This is where Robot Framework comes into the stage. Written by Nokia engineers and Pekka Klarck back in 2005, it’s probably simplest way to understand test automation paradigm.

Awesome! So when that is sorted, and after confirming that Robot Framework is right path for learning test automation, what next? Should you install Visual Studio Code or another IDE, chromedriver, pip package manager, robotframework library on your local machine? Well probably, but not right now. Maybe you do not like how RF feels or maybe it has some drawbacks for your project (if any). Also, if you don't have expiriance in setting up your development environment, there is a good chance you would leave after first couple of tries on setting up all dependencies. In matter of fact, that process can be so daunting and time consuming that one company developed whole business around idea to have online IDE which acts as your local setup (almost) with all libraries you’d need to start up your developing process. They are called replit and all they were trying to improve was how developers can save time when just scathing and trying out their new project, without needing to setup whole environment.

Python environment(s)

So, let’s now create your own test automation framework that can be used for both UI and API testing (API tests in next post). Test framework will have one simple UI test case, it will generate nicely formatted test report, and most importantly, you will be able to understand what it’s doing without knowing Python or Selenium WebDriver.

For example, custom made keyword Headless Chrome — Create Webdriver will be used to set parameters needed for chromedriver, while built-in Set Selenium Speed 1 is there so to mark that one second will pass between executing each selenium command. Feel free to change that to other value and see how the test is behaving. You can find more about built-in and Selenium keywords over here:

https://robotframework.org/robotframework/latest/libraries/BuiltIn.html

https://robotframework.org/SeleniumLibrary/SeleniumLibrary.html#library-documentation-top

Back to replit. Once you created an account, go on and create new repository with Python as a language to be used.

Next, you’d have to install packages for project:

· Robotframework

· Robotframework-seleniumlibrary

· Chromedriver-binary

· Chromedriver-binary-auto

Feel free to delete main.py file from root folder and create new file, in this case it’s websuite.robot.

websuite.robot is the robot script that holds our Suite and Test Setup, Libraries, Keywords and pretty much everything that you need to run mentioned test case. Copy and paste code from this repository to your own websuite.robot file.

https://replit.com/@kikkomanq/NewRFTEst#websuite.robot

*The repository I am sharing is just to copy the code from script, not to run the test itself.

Click on Run button, and in the Shell window you get to see libraries being installed.

Next thing is to run your test case. You do that by running command robot websuite.robot in the shell on the right side. Repeat running same command because there is a chance that replit will only install libraries on first try. If everything goes smooth, you will see that test is PASS.

Success! Congratulation, you have just created test automation framework that can help you learn and understand how the process is functioning.

If you want to check your test report to get more information about execution, go on and copy the code from log.html file, paste it your own local log.html file and open it in the browser.

Report of Test Case executed log.html

To recapitulate, this post is meant for introducing both Replit platform and Robot Framework, and how when those are put together, they create easy to understand test automation framework that you can use for some POC to present to your manger or just as a learning tool. There are plenty of documentation and tutorials that are made for Robot Framework.

To name a few:

https://robotframework.org/

https://github.com/robotframework/HowToWriteGoodTestCases/blob/master/HowToWriteGoodTestCases.rst

https://dev.szabolcstoth.eu/robotframework-basics/01-greetings/01-your-first-test-case/#solution

In next post I will present short script that you can use for automating API requests.

--

--

Milan Novovic

“The first principle is that you must not fool yourself and you are the easiest person to fool.” ― Richard P. Feynman