Ask a Question

How can i in java check if a teststepname already exists

SOLVED
CrazyFrog
Contributor

How can i in java check if a teststepname already exists

Hello 

 

I write my own testautomation script in java using the SoapUI API.

My script create teststeps when the aren't there.

How can i check if a teststep is already created?

 

I can use  the code below, but then i have to create a loop.

Is it possible to do a .indexOf('teststepname)  or something like that (without a loop)?

 

listOfTestSteps = testCase.getTestStepList();

listOfTestSteps.get(x).getName()

 

Thanks

 

Raymond

 

2 REPLIES 2
CrazyFrog
Contributor

Nobody??

Here's how I check:

 

def testStepName = "Name to Check";

if (context.testCase.getTestStepIndexByName(testStepName) == -1)
{
      log.info("test step does not exist");
}
else
{
      log.info("test step exists.");
}




---

Click the Accept as Solution button if my answer has helped, and remember to give kudos where appropriate too!
cancel
Showing results for 
Search instead for 
Did you mean: