Forum Discussion
Hi Chris,
I have confused matters here and not used the correct terminology!
I wish to delete test steps, and not test cases, my apologies. I have updated the subject and initial post to reflect this.
But to expand on your question, I have a groovy script at the beginning of the test case, that imports XML files as "Test Cases", which could mean I end up with over a 100 test steps for this particular test case. What I wish for is the ability to delete all of these XML files, that all begin with the word "Order", rather than having to manually delete them and have it automated.
Hope that makes sense?
Hi Bensb93,
Hope there is no misunderstanding between TestCase and TestSuite, but such a Groovy script should help you doing the job:
// Define the current TestCase
def currentTestCase = testRunner.testCase
// Loop for all steps inside the TestCase
for(step in currentTestCase.getTestStepList()) {
// Define the step name
def stepName = step.getLabel()
// Condition of the test
if (stepName.startsWith("Order")) {
// Log
log.warn "Step: ${stepName} will be removed !"
// Remove the step
currentTestCase.removeTestStep(step)
}
} Tell us if it helps.
David.