Forum Discussion

smtripathi99's avatar
smtripathi99
Occasional Contributor
4 years ago

SoapUI Open Source project test cases are running in indefinite loop

I have a SoapUI project with Test Suite Setup scripts running the test cases multiple times based on a global property but it is running in indefinite loop. Please help me to fix the issue:

 

def project = null     
def workspace = runner.testSuite.project.getWorkspace();
def count=context.expand('${#Global#run}')


if (workspace != null) {
 project = workspace.getProjectByName("IQCX")
}
if (project.open && project.name == "IQCX") {
 def properties = new com.eviware.soapui.support.types.StringToObjectMap()    
 def testcase = project.getTestSuiteByName("TestSuite 1").getTestCaseByName("Login");    
 def testcase1 = project.getTestSuiteByName("TestSuite 1").getTestCaseByName("Logout");    
 if(testcase == null)
 {    
  throw new RuntimeException("Could not locate testcase 'TestCase'! ");
 } else {
// This will run everything in the selected project   
for(int i=1;i<=count;i++){
    if(i!=count){
         testcase.run(new com.eviware.soapui.support.types.StringToObjectMap(), false)
        sleep(70000)
         testcase1.run(new com.eviware.soapui.support.types.StringToObjectMap(), false)
         sleep(5000)
         log.info( "Finished running "+i+" cycle" )
    }
 else if(i==count){
    log.info "count is " + i
    runner.cancel("finish it")
    testcase=null
    return null
    break;
    }
    else{
        break;
        }
 }
 
    runner.cancel("finish it")
    testcase=null
    
return null
 }
} 
else {
 throw new RuntimeException("Could not find project")
}