BakaTenshi
6 years agoOccasional Visitor
Can I loop script base on user input alert answer?
Hi, I would like to ask if its possilbe to loop script base on user input alert answer?
What I would like to get is something like:
def answers = ["YES","NO"] LOOP:
def mapSuite = []
def mapCase = [] testRunner.testCase.testSuite.project.getTestSuiteList().each(){ mapSuite.add(it.getName()) } nextSuite = [UISupport.prompt("Next Suite", "Select Suite", mapSuite)] testRunner.testCase.testSuites[nextSuite.join()].getTestCaseList().each(){ mapCase.add(it.getName()) } nextCase = [UISupport.prompt("Next Case", "Select Case", mapCase)] def tc = testRunner.testCase.testSuite.project.testSuites[nextSuite.join()].testCase[nextCase.join()] def runner = tc.run( null, false ) log.info nextSuite.join() + " - " + nextCase.join() + " Status: $runner.status" answer = [UISupport.prompt("Continue?","", answers)] if(answer.join() == "YES"){ < go back to LOOP > } else{ log.info "DONE" }
Right now I have something similar in every TestCase TearDown Script, where I can either tell it to stop or go to next Case. Problem with this is that I have multiple Cases runing at the same time waiting to finish TearDown Script, all of them ending at the same time when I tell it to stop. (run Case1 > run Case2 > run Case 3 > end Case3 > end Case2 > end Case1)
I am just curious if its possible to have only 1 Groovy script that would handly all of it so cases end before I start next one. (run Case1 >end Case1 > run Case2 > end Case2 > run Case3 > end Case3)
Thanks for answers