Setting soapUI testCaseproperties from a groovy script running in another soapui project
Hi to all,
I have this scenario, in which TEST_PROJECT1 and TEST_PROJECT2 are similar test project but must remain two separate projects. What I am trying to implement is a unique external script (in ENV_PROJECT) that is called from inside each test project, and it shoul be able to change testCase properties inside the test project itself.
For example:
- ENV_PROJECT
TestSuite
TestCase
groovySetPropStep
- TEST_PROJECT1
TestSuite1
TestCase1
groovyScript1
SoapRequestStep1A
SoapRequestSte1B
....
- TEST_PROJECT2
TestSuite2
TestCase2
groovyScript2
SoapRequestStep2A
SoapRequestStep2B
.....
Now when I execute dor example TestSuite1, groovyScript1 should be able to run groovySetPropStep (passing the TestSuite1 context) so that groovySetPropStep can set testCase properties of TestSuite1.
Is it possible? Or is there an alternative way to reach my target?
Thanks in advance.
Ugo
I find it by myself, but put here the answer to help someone...
So groovyScript1 must have the following content
def project = testRunner.testCase.testSuite.project.workspace.getProjectByName("ENV_PROJECT")
project.testSuites['TestSuite'].testCases['TestCase'].testSteps['groovySetPropStep'].run(testRunner, context)while the groovySetPropStep has for example the following content:
testRunner.testCase.setPropertyValue("propAOfTestCase1 ", "someValue");
.......
testRunner.testCase.setPropertyValue("propBOfTestCase1 ", "anotherValue")
I tried and it works... Good!
- I don't think neither this is very common use case nor suggested to have dependency between projects.
By the way, the project won't run with testrunner which is way for the automation.