Managing Test Case with Relay Case
Overview:
Reusing case executions is highly valuable in pipeline orchestration. The output of certain cases can serve as input for other cases, facilitating better orchestration during pipeline execution.
Understanding Relay Case
Relay Case: “Relay” is an attribute of a test case. A test case with this attribute can pass the value of its pre-declared variable(s) as input to other cases within the same pipeline upon its execution completion. Relay Cases facilitate data transmission and sharing, ensuring that dependencies between test cases are properly managed, thereby enhancing the automation and efficiency of the testing process. ( <Glossary> )
Manage Relay Case
Setting a Case as a Relay Case in a Test Case
To designate your case as a relay case, ensure that both the Testany Platform and your test code recognize the environment variable you are using. This requires configuration in two areas::
On the Testany Platform
In your test code
Config on the Testany Platform
Set the environment variable key as the relay key, which can be used in pipeline orchestration.
Go to test case detail page, click edit

Click “Add a new environment variable set,” and enter the KEY name you wish to use as the relay key. The KEY name must match the key you set in your code. You can configure multiple keys as relay keys. (In this example, set AAA and NEW_URL as the relay keys.)

Click the “Save” button, and the AAA
and NEW_URL
environment variables will be available for use in pipeline orchestration.

Add code to your test script
In your test case, use the environment variable TESTANY_OUTPUT_RELAY_SERVICE
to set your output as the relay key.
Sample code
Here’s an example using Postman: you can send a POST request in Postman to set the output value to the relay key.

POST {{TESTANY_OUTPUT_RELAY_SERVICE}}
{
"AAA": "200",
"NEW_URL": "www.bing.com"
}
curl command
curl -X POST ${TESTANY_OUTPUT_RELAY_SERVICE} -d '{"AAA": "200", "NEW_URL": "www.bing.com"}'
Attached test case with relay case example: postman-with-relay-case.zip