Ask a Question

goto - testCase in Groovy

Jasper175
Frequent Contributor

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 3
Jasper175
Frequent Contributor

Re: goto - testCase in Groovy

- - 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.
Jasper175
Frequent Contributor

Re: goto - testCase in Groovy

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
Nilesh
Occasional Contributor

Re: goto - testCase in Groovy

Thank you so much, It worked for me too!

cancel
Showing results for 
Search instead for 
Did you mean: