Automation with Robot Framework
Test environment
The allure-robotframework
Python module must be present in the test environment.
It can be installed with the command:
pip3 install allure-robotframework
Test reference in Squash TM
In order to bind a Squash TM test case to a Robot Framework automated test, the content of the Automated test reference field of the Automation block of a test case must have the following format:
[1] / [2] # [3]
With:
[1]
: Name of the project on the source code repository.[2]
: Path and name of the Robot Framework test, from the root of the project (with the.robot
extension).[3]
: Name of the test case to execute in the.robot
file.
Nature of the exploitable Squash TM parameters
The exploitable Squash TM parameters in a Robot Framework script will differ depending on whether you're using the Community or Premium version of Squash DEVOPS.
Here is a table showing the exploitable parameters:
Nature | Key | Community | Premium |
---|---|---|---|
Name of the dataset | DSNAME | ||
Dataset parameter | DS_[name] | ||
Test case reference | TC_REF | ||
Test case custom field | TC_CUF_[code] | ||
Iteration custom field | IT_CUF_[code] | ||
Campaign custom field | CPG_CUF_[code] | ||
Test suite custom field | TS_CUF_[code] |
Legend:
[code]
: Value of the "Code" of a custom field[name]
: Parameter name as filled in Squash TM
Squash TM parameters usage
When executing a Squash TM automated test case with Robot Framework, it is possible to exploit the Squash TM parameters inside the test.
In order to achieve this, you'll have to follow these steps:
-
Create custom fields in Squash TM and bind them to the project bearing the test plan to execute.
-
Install the squash-tf-services python library on the environment where the Robot Framework execution takes place. It is accessible through the
pip
package management and can be installed by executing the following command line:
python -m pip install squash-tf-services
- Import the library inside the
.robot
file in the Settings section:
Library squash_tf.TFParamService
- You can then retrieve the value of a Squash TM parameter by calling the following keyword:
Get Param <parameter key>
Below is an example of a Robot Framework test file and the corresponding Squash TM test case automation:
Supported versions
Squash AUTOM and Squash DEVOPS have been validated with Robot Framework 4.0. Any recent version should work properly.