Forum Discussion

swati1's avatar
swati1
Occasional Contributor
5 years ago

,Using groovy script to run rest api test suite.How can i add delay between test test cases

Hi,

i am using groovy script to run my REST API test suite and want to put delay for few test cases but not sure how and where.For Eg. test case name is verify password , reconcile password and verify password again.

So want to put delay between reconcile password and verify password again Bz reconile password test case takes time to perform the reconcilation of password where we have to wait for 2-3 minutes atleast .

 

Below is the groovy script that i m using :

def testcases = testRunner.testCase.testSuite.getTestCaseList()
// for all testCases in your test suite...
testcases.each { testcase ->
    // for all testStep inside testCase...
    def teststeps = testcase.getTestStepList()
    mylist = ['https://wevet16742.ms.ds.uhc.com']
  
    for(i in mylist)
    {
 
     teststeps.each { teststep ->
        teststep.setPropertyValue('endpoint',i)
        endpoint = teststep.getPropertyValue('endpoint')
        if(!teststep.getName().equalsIgnoreCase("RunAllTestCase"))
        {
 
         def r = teststep.run(testRunner, context)
         log.info(endpoint)
        log.info "RUNNING Service :: ${testcase.getName()} -> ${teststep.getName()}"
         log.info "RESULT :: ${r.getStatus()}"
         log.info "---------------------------------------------------------------"
       
      
        }
    }
   
    i++
    }
    
    }

 

 

 

thanks,

6 Replies