Automation with Ranorex
This feature is available only in the Ultimate version of Squash.
Configuration of the execution environment
In the execution environment, an environment variable called SQUASH_MSBUILD_PATH containing the path to the parent folder of MSBuild.exe must be created. You can execute the following command to get the path to your MSBuild executable:
reg.exe query "HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0" /v MSBuildToolsPath
Test reference in Squash TM
In order to bind a Squash TM test case to a Ranorex automated test, the content of the Automated test reference field of the Automation block of a test case must have the following format:
[repository]/[solution]#[project]#[suite]#[test_case]
or
[repository]/[solution]#[project]#[suite]
(The reference contains two or three #
characters.)
with:
-
[repository]
: Name of the Git repository. -
[solution]
: The path to the solution's.sln
file from the root of the project source repository. -
[project]
: Project name to execute. -
[suite]
: Test suite name to execute. -
[test_case]
: Test case name to execute.
This parameter is optional, i.e. it may be absent.
Determination of the result of the test case
If a test [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 suite [suite]
:
- 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] |
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 Ranorex 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 ranorex/params
action.
Each parameter is available in Ranorex as a global parameter and, if adequate, as a local parameter (see the Ranorex documentation):
- if the test reference contains a test case name (
[test_case]
above), the parameter, whether a test parameter or a global parameter, will be defined in Ranorex as both a global parameter and a local parameter; - otherwise, if the test reference does not contain the name of a test case, it will only be defined as a global parameter.
If the same name is used for a global parameter and a test parameter, the latter is taken into account in Ranorex.
Example
Below is an example of a Ranorex solution and the corresponding Squash TM test case automation:
Supported versions
Squash has been validated with Ranorex 9.5. Any recent version should work properly.