Skip to content

Automation with Robot Framework

Configuration of the execution environment

The allure-robotframework Python module must be present in the execution environment.
It can be installed with the command:

pip install allure-robotframework

In order to retrieve the Squash TM parameters, the squash-tf-services Python library must be present.
It can be installed with the command:

pip install squash-tf-services

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:

[repository]/[file]#[test_case]
or
[repository]/[file]
(The reference contains zero or one # character.)

with:

  • [repository]: Name of the Git repository.

  • [file]: Path and name of the Robot Framework test, from the root of the project (with the .robot extension).
    It is possible to not indicate a .robot file name and, instead, only define the name of a folder. In this case, all the .robot files of this folder and its sub-folders will be executed.

  • [test_case]: Name of the test case to execute in the .robot file(s).
    This parameter is optional, i.e. it may be absent.

Determination of the result of the test case

If a test case [test_case] is not specified, the result of the Squash TM test case is calculated by taking into account the individual results of each test in the file/folder [file]:

  • If at least one test has an Error status (in case of a technical issue), the status of the execution will be Blocked.
  • If at least one test fails functionally and none of the other ones has an Error status, the status of the execution will be Failed.
  • If all tests succeed, the status of the execution will be Success.

Nature of the exploitable Squash TM parameters

The exploitable Squash TM parameters will differ depending on whether you're using the Community or Premium version of Squash AUTOM.

Here is a table showing the exploitable parameters (these parameters are transmitted as test parameters, see below, Squash TM does not generate global parameters):

Nature Key Community Premium
Name of the dataset DSNAME βœ… βœ…
Dataset parameter DS_[name] βœ… βœ…
Test case reference TC_REFERENCE βœ… βœ…
Test case internal UUID TC_UUID βœ… βœ…
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

As indicated, Squash TM adds a prefix to the code of the transmitted custom field. Make sure to take it into account.

Refer to the Squash TM documentation for more information about custom fields.

Parameters usage

It is possible, when running Robot Framework tests, to exploit parameters within it. A parameter can be a test parameter or a global parameter. Squash TM transmits only test parameters. Test parameters and global parameters can be used in Squash DEVOPS with the robotframework/params action.

In order to achieve this, you have to follow these steps:

  • Import the squash-tf-services library in the Settings section of the .robot file:

    Library squash_tf.TFParamService
    

  • You can then retrieve the value of a parameter by calling one of the following keywords:

    • ${value}=Get Global Paramkey
      ${value}=Get Global Paramkeydefault_value
      This keyword retrieves the value of a global parameter.
      If it exists, its value is assigned to ${value}.
      Otherwise the default value is assigned to ${value}; if no default value was provided, None is used.
      Example:
      ${parameter}=    Get Global Param    target_base_url    http:localhost:8080/sut/
      

    • ${value}=Get Test Paramkey
      ${value}=Get Test Paramkeydefault_value
      This keyword retrieves the value of a test parameter.
      If it exists, its value is assigned to ${value}.
      Otherwise the default value is assigned to ${value}; if no default value was provided, None is used.
      Example:
      ${login}=    Get Test Param    TC_CUF_login    test_user
      

    • ${value}=Get Paramkey
      ${value}=Get Paramkeydefault_value
      This keyword combines both types of parameters.
      If a test parameter exists, its value is assigned to ${value}.
      Otherwise, if a global parameter exists, its value is assigned to ${value}.
      Otherwise, the default value is assigned to ${value}; if no default value was provided, None is used.
      Example:
      ${login}=    Get Param    login    test_user
      

Example

Below is an example of a Robot Framework test file and the corresponding Squash TM test case automation:

Robot Framework example

Robot Framework example

Supported versions

Squash AUTOM and Squash DEVOPS have been validated with Robot Framework 4.0. Any recent version should work properly.