Forum Discussion

Keacey's avatar
16 years ago

Common teardown script for test cases


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.

3 Replies

  • omatzura's avatar
    Super Contributor

    you have several options:

    1) get soapUI Pro and package the script in the Script Library (read more at ... pt_Library). Then make a call to this from within your teardown scripts.

    2) create a TestRunListener extension (read more at 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!


    • tech321's avatar

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

      • nmrao's avatar
        Champion Level 3
        What is your use case? Is it the same as original question or do you have something different use case?