Squash TM test execution plan retrieval with a PEAC


Squash DEVOPS gives you the possibility to retrieve an execution plan for automated tests defined in Squash TM with an EPAC. The EPAC can be triggered by a Jenkins pipeline (see the corresponding page of this guide).


Prerequisites

In order to retrieve an execution plan from Squash TM with an EPAC, you need to perform the following tasks in Squash TM :

  • Create a user belonging to the Test automation server group.

  • Create an execution plan (iteration or test suite) containing at least one ITPI linked to an automated test case, as described in the Squash AUTOM user guide (see here).


Integration of the Squash TM execution plan retrieval step into an EPAC

In order to retrieve an execution plan from Squash TM with an EPAC, you need to call the corresponding generator action.

Here is a simple example of an EPAC in Json format allowing the retrieval of a Squash TM execution plan :

{
    "apiVersion": "opentestfactory.org/v1alpha1",
    "kind": "Workflow",
    "metadata": {
        "name": "Simple Workflow"
    },
    "defaults": {
        "runs-on":"ssh"
    },
    "jobs": {
        "explicitJob": {
            "runs-on":"ssh",
            "generator":"tm.squashtest.org/tm.generator@v1",
            "with": {
                "testPlanUuid":"1e2ae123-6b67-44b2-b229-274ea17ad489",
                "testPlanType":"Iteration",
                "squashTMUrl":"https://mySquashTMInstance.org/squash",
                "squashTMAutomatedServerLogin":"tfserver",
                "squashTMAutomatedServerPassword":"tfserver"
            }
        }
    }
}

A Squash TM generator step must contain the following parameters :

  • testPlanType : Defines the type of test plan to retrieve in Squash TM. Only the values Iteration and TestSuite are accepted.

  • testPlanUuid : This is the UUID of the requested test plan. It can be found in the Description panel by clicking on the Information tab of the iteration or test suite in Squash TM.

  • squashTMUrl : URL of the targeted Squash TM.

  • squashTMAutomatedServerLogin : Name of the Test automation server group user to log into Squash TM.

  • squashTMAutomatedServerPassword : Password of the Test automation server group user to log into Squash TM.

[Optional fields] :

  • tagLabel : Specific to the Premium version - It refers to the name of the tag type custom field on which the test cases to retrieve are to be filtered. It is not possible to specify more than one.

  • tagValue : Specific to the Premium version - It refers to the value of the tag type custom field on which the test cases to retrieve are to be filtered. It is possible to specify multiple ones separated by “|” (Example: value1|value2). There has to be at least one value specified for the test case to be taken into account.

Warning

If one of the two tagLabel or tagValue fields is present, the other must also be specified.


Squash TM parameters to exploit in a Robot Framework automated test

By executing an EPAC retrieving a Squash TM execution plan, Squash TM passes various informations on ITPIs that can be exploited in a Robot Framework test case.


Nature of the Squash TM parameters to exploit

The exploitable Squash TM parameters in a Robot Framework script will differ depending on the usage of a Squash DEVOPS Community or Squash DEVOPS Premium licence.

Here is a table of the exploitable parameters :

Nature

Key

Community

Premium

Name of the dataset

DSNAME

../_images/ok.jpg ../_images/ok.jpg

Parameter of a dataset

DS_[name]

../_images/ok.jpg ../_images/ok.jpg

Reference of a test case

TC_REF

../_images/ok.jpg ../_images/ok.jpg

Test case CUF

TC_CUF_[code]

../_images/ok.jpg ../_images/ok.jpg

Iteration CUF

IT_CUF_[code]

../_images/ko.jpg ../_images/ok.jpg

Campaign CUF

CPG_CUF_[code]

../_images/ko.jpg ../_images/ok.jpg

Test suite CUF

TS_CUF_[code]

../_images/ko.jpg ../_images/ok.jpg

Legend :

  • CUF : Custom Field

  • [code] : Value of the “Code” field of a CUF

  • [name] : Name of the parameter as filled in Squash TM


Usage of Squash TM parameters in a Robot Framework test case

When executing a Squash TM automated test case with Robot Framework, it is possible to exploit Squash TM parameters inside the test case.

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

  • Install on the environment(s) where the Robot Framework execution takes place the squash-tf-services python library. 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>

Here is an example of a Robot Framework test case exploiting Squash TM parameters :

../_images/robot-test-case-with-param-1.png

Results publication in Squash TM at the end of the execution

The nature of the results published in Squash TM at the end of the execution will depend on the usage of a Squash AUTOM Community or Squash AUTOM Premium licence.

Please refer to the Squash AUTOM 1.0.0.alpha1 user guide for more informations (see here).