cancel
Showing results for 
Search instead for 
Did you mean: 

Common teardown script for test cases

Contributor

Common teardown script for test cases

Hi,

I have created a groovy script for test case teardown. But since the script is  common for all test cases and i do not change anything in it, i copy-paste the same script for all the test case teardown.

Is there any way, by writing another groovy script (and probably running it initially before the i run the test cases), i can send this script to all the testcase teardown in a test suite? also can i write this script externally, maybe a .txt file and then import the content to the teardown script window.

Thanks in advance.
Kusuma.
3 REPLIES 3
Super Contributor

Re: Common teardown script for test cases

Hi,

you have several options:

1) get soapUI Pro and package the script in the Script Library (read more at http://www.soapui.org/userguide/scripti ... pt_Library). Then make a call to this from within your teardown scripts.

2) create a TestRunListener extension (read more at http://www.soapui.org/architecture/extensions.html) and implement the afterRun method to do you what you need. This will be run for all TestCases so remember to check that you are "within" the desired TestCase/TestSuite. If you use soapUI Pro, you can create the extension in groovy (and/or use the Script Library) with support for instant recompiling so you wont have to restart to reload changes to the extension.

Hope this helps!

regards,

/Ole
eviware.com
Occasional Contributor

Re: Common teardown script for test cases

can you pleae provide an example of how to write a teardown script?

Community Hero

Re: Common teardown script for test cases

@tech321,
What is your use case? Is it the same as original question or do you have something different use case?


Regards,
Rao.
New Here?
Join us and watch the welcome video: