Automation with Katalon
This feature is available only in the Ultimate version of Squash.
Katalon support is available starting with Squash TM 3.0.
Configuration of the execution environment
katalonc
(which is the Katalon Runtime Engine) must be present in the execution environment and accessible by the PATH
environment variable.
Environment variables
The following three system environment variables must be defined in the execution environment:
Variable | Content | Example |
---|---|---|
KATALON_API_KEY | Katalon API license key | 123a4567-123a-1ab2-1234-1234567890ab |
KATALON_ORG_ID | Organisation ID at Katalon | 123456 |
KATALON_BROWSER_TYPE | Default browser type | Web Service |
Additionally, the following environment variable can also be defined:
Variable | Content | Example |
---|---|---|
KATALON_EXECUTION_PROFILE | Execution profile to use | production |
Test reference in Squash TM
In order to bind a Squash TM test case to a Katalon automated test, the content of the Automated test reference field of the Automation block of a test case must have the following format:
[repository]/[project]#[collection]#[suite]#[test_case]
(The reference always contains three #
characters.)
with:
-
[repository]
: Name of the Git repository. -
[project]
: Path to the name of the Katalon project file (with its.prj
extension) from[repository]
. -
[collection]
: Relative path from the Katalon project folder to the name of the test suite collection.
This parameter is optional, i.e. the string[collection]
may be empty.
This parameter is exclusive with respect to[suite]
([collection]
and/or[suite]
must be empty). -
[suite]
: Relative path from the Katalon project folder to the name of the test suite.
This parameter is optional, i.e. the string[suite]
may be empty.
This parameter is exclusive with respect to[collection]
([collection]
and/or[suite]
must be empty). -
[test_case]
: Relative path from the Katalon project folder to the name of the specific test case to be parsed for which you want to obtain a particular result.
This parameter is optional, i.e. the string[test_case]
may be empty.
Automated test reference and execution
The test case precision [test_case]
in the test reference has no impact on the execution, but only on test result determination.
So, even when defining the specific level of the specific test case, all test cases defined in the test suite collection or in the test suite will be executed (this means, for example, that if several Squash TM test cases point toward the same test suite collection or toward the same test suite, but toward different test cases, then all the test cases will be executed several times).
The test reports include the traces of all executed requests. But, only the Error / Failed / Success status corresponding to the specific test case is used to determinate the test case result.
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 Katalon test case belonging to the test suite collection or to the test suite of the executed Katalon project file (.prj
):
- 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
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 |
---|---|
Name of the dataset | DSNAME |
Dataset parameter | DS_[name] |
Execution ID | TC_EXECUTION_ID |
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
Availability of the execution ID
TC_EXECUTION_ID
is only available with Squash TM 8.0 or later.
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 documentation for more information about custom fields.
Parameters usage
It is possible, when running Katalon 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 the case of a launch from a CI/CD pipeline with the katalon/params
action.
The test parameters and the global parameters are usable as global variables in Katalon using the GlobalVariable.param_name
syntax (see the Katalon documentation). If the same name is used both for a global parameter and a test parameter, the last one is used.
Order of priority in case of variable homonymy
The same variable can be defined in various places, in this case, the order of precedence is (in decreasing order):
- The variable of a dataset or of a CUF in Squash TM (ex:
gid
= 29428053 in theJDD_DEMO_POSTMAN
dataset, which will be transmitted under the nameDS_gid
). - If an execution profile is defined via the
KATALON_EXECUTION_PROFILE
environment variable, then the global variable if defined in that profile (ex:DS_gid
= 36483577 in theproduction
profile). - The global variable coming from the profile named
default
, i.e. not the profile defined as default profile, if it is defined in that profile (ex:DS_gid
= 31338079 in thedefault
profile).
This makes it possible to define default values ​​in the Katalon execution profiles and to optionally overwrite them in Squash TM.
Example
-
Setting global variables in the default profile of the Katalon project
katalon-samples
: -
Declaration of test case
3_PARAMS_TestCase_01_With_GlobalID
in test suite3_TestSuite_Params_Action
: -
Definition of this test case:
-
Retrieving the value of the
DS_url
andDS_gid
parameters (corresponding to theurl
andgid
parameters of the Squash TM dataset) in the test case: -
Definition of the dataset in Squash TM:
Execution profile selection from Squash TM
Squash TM 4.1 (or later) allows the definition of environment variables in the execution environment. Thus, via the KATALON_EXECUTION_PROFILE
environment variable, it is possible to select the execution profile to be used when running the Katalon tests.
Continuing the previous example:
-
Setting the
KATALON_EXECUTION_PROFILE
environment variable: -
Association of the environment variable with the Squash Orchestrator:
-
Definition of the value of the environment variable when launching the tests:
The PRJ_DEMO_KATALON_T3_TESTSUITE_Params_Action_OK
test case will be executed with the production
profile.
Supported versions
Squash has been validated with the following versions of Katalon. More recent versions should work properly.
Testing Technology | Version |
---|---|
Katalon 💎 | 8.2.0 |