Running a specified action/test after a test case

deejay220989deejay220989 Posts: 4

I would like to know if there is a way to do an action after a test case is done.

Here's my scenario: I would like to create a lot of tests for HTTP POST, which updates records. After a test case is done, I would like to revert back the values of my record using another API call, and use it for another test, or use it for the same test.

I believe I can create a Test Suite, and create 2 test cases there, one is the actual test, and another to revert, but if I have like 50 test cases, then I'll need 50 test suites? :(

Please advise.

Thanks!

Comments

  • benken_parasoftbenken_parasoft Posts: 736 ✭✭✭

    If you don't want to create 50 copies of a "revert" test then consider creating it once as a global tool and then referencing it 50 times. You can reference a global tool as a test or as an output tool. If you chose to add it as a output tool then you can add it in bulk by selecting all the tests you wish to chain it to before opening the Add Output dialog.

  • deejay220989deejay220989 Posts: 4

    I don't get how can I reference global tool as a test? is there a guide I can follow?

  • benken_parasoftbenken_parasoft Posts: 736 ✭✭✭
    edited July 22

    Here are some resources from the docs which may help you:

    Use Existing Tools for Repeated Tool Configurations or Tests
    - High level summary about best practices

    Global Tools
    - Explains how to create a global tool. After you created one, you can reference it on the "Existing Tools" tab whenever you add a new test or tool output.

    Adding Multiple Outputs
    - Explains how to add output tools in bulk, including references to global tools.

Sign In or Register to comment.