Have you ever wished you could reuse a set of tests and avoid that pesky duplication? Well, with the addition of Subtest Steps, now you can and it's as easy as pie!
For starters, let's take a look at the most common use cases for using subtests:
- Reuse Common Functionality
Need to generate a refresh token on each test run? Now you can create a test to generate a token and use that test as a step in other tests. When the token generation process changes, you only need to update it in one place.
- Setup/Teardown Steps
If your tests need to set up data before running, or clean up after themselves, subtests can group the required API calls for setup and teardown into a single, reusable step.
- Organize Your Tests into Suites
Running a set of related tests as a group is now possible. Create suites of related tests and run them all together as a unit, with notifications for the result of the whole suite.
You can find the Subtest Step option in your Test Editor under "+Add Step":
And this is what it will look like:
You can specify the test's Bucket, Name, and Environment to be used as a subtest, and you can position it anywhere in your Steps workflow.
Subtests are a powerful tool to help you create a more robust set of tests, while also simplifying your workflow. To make things even better, you can also pass dynamic data from other steps to subtests, and extract data from the result to use in subsequent steps.
In the next weeks, we'll be showing a few use cases for how you can use subtests to improve your API tests workflow. If there's anything specific you would like to see, please let us know by reaching out to us on Twitter @Runscope, or email us at firstname.lastname@example.org.