Forum Discussion

ankush's avatar
ankush
Occasional Contributor
8 years ago

soapui setup script not executed when test case or test step run from java

Hi,

 

When I try to run an individual test case or a test step in a test suite from Java , The set up script for the test suite is not executed !

 

Any way to run this setup scrip explicitly ?

or any other work around except having individual set up scripts for a test case ?

8 Replies

  • KarelHusa's avatar
    KarelHusa
    Champion Level 3

    The setUp script of the suite is executed when the test suite is launched. Similarly a test case setUp script is started when a test case is started. So if you launch the test case or a test step, the test suite setuUp script is not executed.

     

    If you open the setUp script (via test suite editor), you can execute the setUp script manually (by the green arrow button). If you want to do the same with scripting, you can use the API:

     

    testSuite.runSetupScript(context, runner)

    I suggest either to launch the whole test suite or to use a more suitable place where to put the script (on test case level, Groovy script test step or other option). 

    • ankush's avatar
      ankush
      Occasional Contributor

      Thanks, that helps.

       

      Could you please let me know how to set context and runner arguments here ?

      • nmrao's avatar
        nmrao
        Champion Level 3

        In the test suite setup both variables are available.

        Like KarelHusa rightly suggested, please the execute test case / suite appropriately.

  • nmrao's avatar
    nmrao
    Champion Level 3
    At what (test suite / test case or project) level setup script is placed?
    • ankush's avatar
      ankush
      Occasional Contributor

      Setup script is placed at test suite level .