Forum Discussion

ripplegupta's avatar
ripplegupta
Contributor
9 years ago

How to update description property of a test step via groovy

How to update description property of a test step via groovy.   Each test step has description , how can i update it via groovy ?
  • KarelHusa's avatar
    KarelHusa
    9 years ago

    You are right. The REST test step behaviour seems to be different than other types of steps.

     

    See the following code, it's rather a workaround, but it does the job.

     

    context.testCase.getTestStepList().each {
    	def desc = 'New description - TEST'
    	def step = it
    	step.setDescription(desc)
    	if (step.getDescription() != desc) {
    		// here we come with REST test step
    		log.info step.getName() + ":" + step.getDescription()
    		step.getTestRequest().setDescription('Another description')
    	}
    }