DEV Community

Jim Priest
Jim Priest

Posted on

Robot Framework Docker Container

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$ 
Enter fullscreen mode Exit fullscreen mode

Top comments (5)

Collapse
 
kenjiro profile image
Kenjiro Sarjonator

5 29.52 /bin/sh: pip3: not found


executor failed running [/bin/sh -c apk update && apk upgrade && echo @latest-stable nl.alpinelinux.org/alpine/latest-s... >> /etc/apk/repositories && echo @latest-stable nl.alpinelinux.org/alpine/latest-s... >> /etc/apk/repositories && apk add --no-cache chromium@latest-stable chromium-chromedriver@latest-stable python3 && pip3 install robotframework robotframework-seleniumlibrary faker==2.0.1 robotframework-faker==4.2.0 && rm -rf /var/lib/apt/lists/* /var/cache/apk/* /usr/share/man /tmp/*]: exit code: 127

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

Some comments may only be visible to logged-in visitors. Sign in to view all comments.