Forum Discussion

mayur_vats's avatar
mayur_vats
Occasional Contributor
5 years ago

Project teardown script executes only when tests are executed from project test runner

Hi I am trying to run certain scripts in project's tear down section to generate a custom result file. To start with I found out that project teardown scripts will execute only when we launch the script execution from project test runner. If we execute scripts from the test suite's test runner option then the project's tear down script will be not be executed.

 

Is this understanding correct? Can anyone confirm how to call projects' tear down script every time we run our scripts either from the test case or test suite level?  

  • Hey mayur_vats

    Yep...the behaviour you mention is as its required to be....or at least its the same behaviour ive noticed in readyapi!

    You could add ylteardown scripts to your testsuites and testcases if you need the scripts to execute for individual tests or testsuites but im guessing youll need to alter the slightly.

    You might be able to add a groovy snippet (final step or script assertion or a teardown) in each of tge testcases to actually call the project teardown script, although i dunno how to do that and even if its easy, it seems really rubbish and inefficient to bother.....youd have to update ebery single test

    Rich
  • Thank you for your response. I have recently started and was quite confused with the behaviour of the execution. Thank you for confirming that this is the standard behaviour.

  • richie's avatar
    richie
    Community Hero
    Hey mayur_vats

    Yep...the behaviour you mention is as its required to be....or at least its the same behaviour ive noticed in readyapi!

    You could add ylteardown scripts to your testsuites and testcases if you need the scripts to execute for individual tests or testsuites but im guessing youll need to alter the slightly.

    You might be able to add a groovy snippet (final step or script assertion or a teardown) in each of tge testcases to actually call the project teardown script, although i dunno how to do that and even if its easy, it seems really rubbish and inefficient to bother.....youd have to update ebery single test

    Rich
    • mayur_vats's avatar
      mayur_vats
      Occasional Contributor

      Thank you for your response. I have recently started and was quite confused with the behaviour of the execution. Thank you for confirming that this is the standard behaviour.