Forum Discussion

gniposoave's avatar
gniposoave
Occasional Contributor
4 years ago
Solved

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 (i...
  • gniposoave's avatar
    4 years ago

    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!

     

  • nmrao's avatar
    nmrao
    4 years ago
    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.