Forum Discussion

zhyt's avatar
zhyt
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
----TestSuite1
----------TestCase1
---------------MainGroovyScript (this is a main automation script)
---------------TestStep1.1
---------------TestStep1.2
......
----------TestCase2
---------------TestStep2.1
---------------TestStep2.2
......
----TestSuite2
----TestSuite3

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:

Runner.runTestStepByName(TestStep1.1)
Runner.runTestStepByName(TestStep1.2)
// problem
Runner.testCase.testSuite.getTestCaseByName("TestCase2").runTestStepByName("TestStep2.1")
Runner.testCase.testSuite.getTestCaseByName("TestCase2").runTestStepByName("TestStep2.2")

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
    zhyt
    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 );

    runner1.runTestStepByName("TestStep2.1")
    runner1.runTestStepByName("TestStep2.2")


    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_Suppo
    SmartBear Alumni (Retired)
    Hi!

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

    regards!

    /Ole
    eviware.com
    • suryakiranvadag's avatar
      suryakiranvadag
      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")