loading...

Robot Framework Docker Container

jimpriest profile image Jim Priest ・2 min read

Alt Text

We've been using Robot Framework at work for awhile with great success. When I initially started doing Robot I just setup Python and pip installed everything on Testers workstations. At the time I used Python 2.6. This works but Python 2.6 is EOL soon, and maintaining different libraries, webdriver versions, etc became a huge hassle.

Enter Docker!

After searching around there are quite a few Dockerized Robot setups but they all had issues:

  • Some were using Xvfb instead of native headless browsers
  • Some were using Chrome but with --no-sandbox option (bad)
  • Some were doing a lot more than what I needed - Firefox, Selenium grids, etc.

I decided to take the best bits from all of them and create my own simple Robot Framework container.

It's running Alpine, Python 3, Robot Framework, Chromium (headless!) and that's it.

I'm also giving a presentation in the near future on Robot Framework at a local Meetup so in addition to building a Docker container you can use to run your own Robot tests I also added some basic Robot Framework test examples if you are just getting started with Robot Framework.

Files are available on my Github

Make sure to scan the README.md.

Happy Testing!

./robot.sh --suite a-simple
==============================================================================
Robot                                                                         
==============================================================================
Robot.Tests                                                                   
==============================================================================
Robot.Tests.A-Simple                                                          
==============================================================================
Robot.Tests.A-Simple.Test :: A very simple test suite with a single test      
==============================================================================
Open Site                                                             | PASS |
------------------------------------------------------------------------------
Robot.Tests.A-Simple.Test :: A very simple test suite with a singl... | PASS |
1 critical test, 1 passed, 0 failed
1 test total, 1 passed, 0 failed
==============================================================================
Robot.Tests.A-Simple                                                  | PASS |
1 critical test, 1 passed, 0 failed
1 test total, 1 passed, 0 failed
==============================================================================
Robot.Tests                                                           | PASS |
1 critical test, 1 passed, 0 failed
1 test total, 1 passed, 0 failed
==============================================================================
Robot                                                                 | PASS |
1 critical test, 1 passed, 0 failed
1 test total, 1 passed, 0 failed
==============================================================================
Output:  /robot/results/output.xml
Log:     /robot/results/log.html
Report:  /robot/results/report.html
jim@jim:/mnt/Files/www/robotframework-preso$ 

Discussion

pic
Editor guide
Collapse
simeonpoot profile image
SimeonPoot

I was scrolling through your readme.md on your github repo and I noticed that your versioning is “latest”. It’s a good habit to set the correct version in stead of latest making the container reliable / predictable when spinning up. If there’s a versioning skew, things will break.
regards

Collapse
taspolle8 profile image
taspolle8

As a rather new to browser testing, I have a question for you.
Considering you are using alpine in the box, the OS where chromium runs is not taken in the question when running browser tests?

Collapse
jimpriest profile image
Jim Priest Author

You have to remember it's just running the Robot tests - against my real webserver. I'm not too concerned over possible minor differences in browsers across OS. If I was concerned I'd also use a service like CrossBrowserTesting or something similar.

Collapse
taspolle8 profile image
taspolle8

thanks! That's been lately by battle, considering docker, whether to run the tests on a browser sitting on the OS client is using, or using different OS.

Cloud services are not an option for us unfortunately.