This topic describes how to use Groovy script to run a test step from another project.
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.
Example
The following code demonstrates how you can run a test step from another project of your choice using the built-in scripting objects of ReadyAPI:
Groovy
// Replace names of a project, test suite, case and step with those you need.
// Connecting to the test step in another project.
def prj = testRunner.testCase.testSuite.project.workspace.getProjectByName("ProjectName")
tCase = prj.testSuites['TestSuiteName'].testCases['TestCaseName']
tStep = tCase.getTestStepByName("TestStepName")
// Calling the test runner and checking if it can run the specified step.
def runner = tStep.run(testRunner, context)
log.info ("runner status ....... : " + runner.hasResponse())