Testing with Robotframework

Testing with RobotFramework

This is an introduction to testing with the robotframework Python package. In this demo I use Vagrant and Ansible to create a pristine testing environment to run the RobotFramework tests.

Grab the example code from Github first:

You will need Vagrant and Python 3 installed on your host system.

  • Install Vagrant

    • CentOS/RHEL - sudo yum install vagrant

    • Ubuntu/Mint - sudo apt install vagrant

  • Install Python

    • CentOS/RHEL - sudo yum install python3 python3-virtualenv

    • Ubuntu/Mint - TBD

Once these are installed, we can start the test. Make sure you are in the octave_tester directory. First step is to setup the Python environment that will be used for the test. The setup creates a local Python virtualenv then installs Ansible, RobotFramework and the RobotFramework SSH library.

make setup

Next, we will build the Vagrant box. I like to use Vagrant, whether to spin up a local instance on my host or on a remote hypervisor (VMWare, AWS, GC2 for example) to ensure that I start from a pristine environment. Now, depending on what you are testing this may be overkill, but I've seen too many hard to pinpoint bugs related to differences in the host setup to discount it. The build-box launches a CentOS 8 environment then hands off configuration to an Ansible provisioning script. Ansible installs the necessary packages and sets up the remote host.

make build-box

Now we can run the test. The test script runs the robot command from our local Python virtual environment and steps through each, capturing the detail that I need.

make run-test

One the test completes, results are available in the Test_Results directory. Here is a screenshot of the log.html file from the output directory.

Hope this introduction is helpful to you.