Using BDD and Cucumber in Squash AUTOM
This page describes how to use BDD and Cucumber: declaring Gherkin test cases, implementing the tests, and running them.
Overview of the process
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
Used versions
This HOWTO uses
- Squash TM 3.0.2
- Cucumber-JVM 7.2.3
- Java 11.0.13
- Maven 3.6.3
but its content is mostly applicable to any version of these, only some technical details will change if using another version of Squash TM, Cucumber, Java, or Maven.
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.
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.
The example provided here does not currently contain Web Service tests.
Accessing the code
The code used in this sample is available in https://gitlab.com/henixdevelopment/open-source/code-samples/howto-bdd-cucumber-01.