Skip to content

Using BDD and Robot Framework in Squash AUTOM

This page describes how to use BDD and Robot Framework: declaring Gherkin test cases, implementing the tests, and running them.

The target audience for this HOWTO is:

  • The persons who want to have an overview of the whole process, they can go through the document, skipping the technical details.
  • The persons who will be involved in such a process.
    For the administration part, they should know the basics of Squash TM administration. Pointers toward precise instructions are provided.
    For the test automation part, they should know the basics of Git and of Robot Framework. Some architecture and coding tips are provided. The code uses the Browser library to interact with the browser.

Overview of the process

Setting the scene

We will see how a development team in charge of creating an e-commerce site will set up automated tests to validate the first functionalities delivered by the developers: account creation, login and filling the shopping cart. By mutual agreement, they decided to formalize the test cases in Gherkin in order to avoid ambiguities and to ensure the reuse of the test steps. The automatician will use the technologies she masters to save time.

Involved personas

We will use the following personas in this HOWTO:

  • Pravash, the product owner for the project;
  • Fabrice, the functional tester;
  • Antonine, the automation programmer in charge of implementing the test cases defined by Fabrice;
  • Annita, the Squash TM administrator.

Phases

The phases we will describe are:

Annita
Squash TM administrator
Pravash
Product owner
Fabrice
Functional tester
Antonine
Automatician
Set up Squash TM
Write requirements
Write test cases
Transmit test cases
Get test cases
Automate test cases
Deliver automated test cases
Indicate automation is performed
Run automated tests

(You can click a phase to access it directly.)

Some initial remarks

Test strategy

This example describes how to perform User Interface tests. Their goal is to verify that the UI behaves properly, not to check that user workflows are handled as expected (e.g. that an order is properly generated and recorded in the order database).
That workflows should be tested at the service level, by calling the Web Service API (SOAP, REST, GraphQL…) of the SUT. Web Services tend to be much more stable that the UI, so the maintenance cost is lower for Web Service tests than for UI tests. Web Service tests are also simpler and faster to write.
Currently, the HOWTO does not contain any Web Service tests.

Accessing the code

The code used in this HOWTO is available in https://gitlab.com/henixdevelopment/open-source/code-samples/howto-bdd-robotframework-01.

Used versions

This HOWTO uses

but its content is mostly applicable to any version of these, only some technical details will change if using another version of Squash TM, Robot Framework, or Python.

Installing Prestashop as a SUT example

We need an example SUT for illustrating the BDD test lifecycle. For this purpose, we use the demo of Prestashop. If you want to reproduce the steps described in this document, this page describes how to install Prestashop.