Humanid 1652487954543
Humanid 1652487954543

Reputation: 127

Groovy script that runs a test case in another project

I have two separate projects in SoapUI. I need to transfer a property from Project 1 to Project 2.

Also every time Project 2 is executed I need it to run a test case within Project 1 to get an updated property value.

Project 1

Project 2

I found a Groovy script that will take a property from another project.

testRunner.getTestCase().getTestSuite().getProject.getWorkspace().getProjectByName(project name)
testSuite = project.getTestSuiteByName(suite_name);
testCase = testSuite.getTestCaseByName(testcase_name);

However I am stuck on how to run a test case in a different project with a Groovy script

Upvotes: 0

Views: 2431

Answers (1)

Tom
Tom

Reputation: 106

You need to call run() on the testCase you wish to run :

testCaseToRun = testRunner.testCase.testSuite.project.workspace.getProjectByName('Request-Add A Person').testSuites['TestSuiteContainingTestCaseToRun name'].testCases['TestCaseToRun name']
testCaseToRun.run(null,false)
idToTransfer = testCaseToRun.getPropertyValue('idFieldName')

Upvotes: 6

Related Questions