Forum Discussion

VJ1's avatar
VJ1
Occasional Contributor
9 years ago

TestCleanUp - How to set a project property value as a last step of execution?

Hello,

 

I am very new to SoapUI and I would appreciate if any one can help me here. As a part of test clean up(last step of entire execution, whether the test is run at project level or test suite level), I want to set a project property to false, Where would I write project.setPropertyValue("MyProperty", "false") ?

 

Also, at run time, how do I know if the test is run at Project Level or TestSuite level ?

 

Thanks!

VJ

2 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3
    What is your use case exactly? From your description it is not clear what are you trying to achieve? Can you please add the details?
    • VJ1's avatar
      VJ1
      Occasional Contributor

      Hi Rao,

       

      Thanks for getting back to me on this. I will do my best and explain my use case below.

       

      1. Project Structure -- MyProject (project)

                                                - PreReq1(suite)

                                                - PreReq2(suite)

                                                - PreReq3(suite)

                                                - Feature(Fsuite1)

                                                - Feature(Fsuite2)

                                                - etc.,

       

      2. Use Case 1 :  Run the entire suite for the project like "testrunner.bat     -Exx .....myproject.xml". Works perfect as the tests are executed sequentially

      3. Use Case 2: Run only Fsuite1 like "testrunner.bat -s"Fsuite1" -Exx ......myproject.xml". To do this I have some groovy script in "TestSuiteRunListerner.beforeRun" event to run the required PreReq1, PreReq3 before running Fsuite1. Works fine as well by itself, but breaks Use Case1 and executes my pre-req's multiple times when exectuing Fsuite1, Fsuite2.... thus duplicating running my pre-reqs when not needed.

       

      So I want to capture this exception and created a flag in project property. I set this flag to true when my pre-reqs are run, but not sure where I can reset this flag to false at the end of the execution which is applicable to both the use cases above. "ProjectRunListerner.afterRun" does not seem to be fired if the execution is at suite level. So I am stumped here.

       

      Hope I am clear. Please get back with me if not.

       

      Thanks!

      VJ