Forum Discussion

zhyt's avatar
New Contributor
14 years ago

soapUI+groovy+different test cases

Hi all.
I've got a problem while writing automated groovy script in soapUI.
I have a next structure of project:
----here some WLSDs
---------------MainGroovyScript (this is a main automation script)

Now problems:
- in my MainGroovyScript when I call testRunner.runTestStepByName("TestStep1.1") I get an error "No such property testRunner for script1 ....". Well, I looked for this problem in your forum and found an answer - update soap to new nightly build. For some reasons I cannot do this. BUT when I use Runner.runTestStepByName("...") rather than testRunner.runTestStepByName("...") my testStep runs as it should. Goblin magic . Can somebody explain me the difference?

- now I want to run the TestStep1.1 --> TestStep1.2 --> TestStep2.1 --> TestStep2.2 from my MainGroovyScript. So I have to write something like this:

// problem

But when I write this - i get an error: "No such property testCase for script1..." or some times when I play with testCase.testSuite.project.... - i get a NullPointerException. Can you help me with running different test steps from different test cases?

Best regards, Evgenii.

4 Replies

  • zhyt's avatar
    New Contributor
    hehe, more clear search and here are the answer on second question:
    def testcase = Runner.testCase.testSuite.project.testSuites["TestSuite1"].getTestCaseByName ("TestCase2")

    WsdlTestCaseRunner runner1 = new WsdlTestCaseRunner( testcase,null );


    But the first question is still in power. If I use the line:
    def testcase = testRunner.testCase.testSuite.project.testSuites["TestSuite1"].getTestCaseByName ("TestCase2")
    I get an error: No such property testRunner bla-bla-bla.
    Any ideas?
  • SmartBear_Suppo's avatar
    SmartBear Alumni (Retired)

    wow.. that sounds really odd.. where/how in soapUI are you running this script?


    • suryakiranvadag's avatar
      New Contributor

      From where are you trying to access?

      if you are trying to access it from setup script testrunner cannot be accessed and throws this error.

      instead testRunner try runner.testCase.getPropertyValue("propertyname")