Forum Discussion

Jasper175's avatar
Jasper175
Frequent Contributor
14 years ago

goto - testCase in Groovy

Hello,
Anyone know if there is a parameter in groovy to 'goto' a testCase? Or better yet to run a particular testSuite?

I have many testSuites --
In the first one I'm verifying if the testSuite properties are populated. Whatever someone keeps blank in the property table creates a scenario that I would need to have the result execute a particular testSuite.

or

If that can't happen what if put my testCases in one Suite:
TestCase-Start
TestScenario-1
TestScenario-2
TestCase-Final

Based on "IF" scenarios in "TestCase-Start" - is there code for Groovy to goto "TestScenario-2" and skip 1?

Thank you,
Rob

3 Replies

  • Jasper175's avatar
    Jasper175
    Frequent Contributor
    - - ok I found a forum topic that took me some time to decode. So this worked:

    def testCase1 = testRunner.testCase.testSuite.project.getTestSuiteByName("Test-Verify").getTestCaseByName("TC-3")
    def properties = new com.eviware.soapui.support.types.StringToObjectMap ()
    def async = false
    testCase1.run (properties, async)


    HOWEVER!!! Two things:
    1. This creates a popup message with "OK" button - can that be removed?
    2. I want this testCase to run under a condition:
    if((firstName == '')&&(emailAddress == ''))

    How do I sew that code in? I do have them defined.
    • Nilesh's avatar
      Nilesh
      Occasional Contributor

      Thank you so much, It worked for me too!

  • Jasper175's avatar
    Jasper175
    Frequent Contributor
    Ok - found my problem
    after creating the necessary 'def'

    if((firstName == '')&&(emailAddress == '')&&(lastName > ''))
    {
    testCase3.run (properties, async);
    }
    if((firstName > '')&&(emailAddress == '')&&(lastName == ''))
    {
    testCase1.run (properties, async);
    }


    SO - I'm still stuck with this "OK" popup.... that's the last thing.
    Thank you