This topic describes how to use Groovy scripts to Load Test a Test Case that depends on another Test Case in a Load Testing scenario with more than one VU running the same Test Cases and which have shared resources (e.g., a custom property).
Where to use
There are two ways to run this script:
- As a Groovy Script test step.
- As a setup or teardown script on the project, test suite, or test case level in functional tests.
- In a Load Testing scenario with more than one VU running the same Test Cases.
Example
Groovy
def project = testRunner.testCase.testSuite.project
def clonedTestCase = project.testSuites["Your Test Suite"] .getTestCaseCloneByName("Other Test Case Name")
The clonedTestCase
can be safely used in your Load Test since it is unique for each instance of the run test (unique per VU),so it eliminates concurrency issues.
Sample Project
We have prepared a sample project for customers as a starting point to use this feature. Please download this same project and import it to ReadyAPI.