Ask a Question

Can we call Project level Tear down script from groovy test step?

SumitM
Occasional Contributor

Can we call Project level Tear down script from groovy test step?

Is there a way to call project level tear down script from any groovy script test step?

 

If yes, then can please some one show how to achieve it

2 REPLIES 2
groovyguy
Champion Level 0

It is theoretically possible, but I have not figured out specifically how to make it work yet. You can use the following code:

 

context.testCase.testSuite.project.runAfterRunScript();

Which will not work, but that is due to the fact that it is expecting two arguments/parameters. I cannot figure out what to use for it, which are defined as: 

  1. com.eviware.soapui.model.testsuite.ProjectRunContext
  2. com.eviware.soapui.model.testsuite.ProjectRunner



---

Click the Accept as Solution button if my answer has helped, and remember to give kudos where appropriate too!

There might be a different way. You could retrieve the contents of the Project tear down script, and then evaluate/run that as a script.

 

// Get the contents of the Tear Down Script at the Project level
def script = context.testCase.testSuite.project.getAfterRunScript();

// Execute the contents as a script
new GroovyShell().evaluate(script)



---

Click the Accept as Solution button if my answer has helped, and remember to give kudos where appropriate too!
cancel
Showing results for 
Search instead for 
Did you mean: