Many different API testing use-cases rely on some form of static
data fixtures to test various instances of an application. For
example, it's common to use seeded data when testing pre-production
API environments like staging
or qa
. It's also common to have set
of test users in production systems specifically for automated
testing.
Assertible's new environment level variables feature makes it easier and faster to write reliable tests using these static data fixtures, no matter where your web service is deployed.
Environment variables are great for:
- Representing seed data fixtures in pre-production and production environments.
- Avoiding superfluous setup and teardown steps, making tests more robust and less flaky.
- Reducing duplication of variables between tests
- Reducing test maintenance by sharing common data
Setting up environment variables for your API tests
There are 3 places you can configure variables in Assertible:
Similar to environment auth, variables have an established precedence to make it easier to override variables on specific tests. The precedence is as follows:
- Test variables (highest precedence)
- Dynamic variables
- Environment variables (lowest precedence)
For example, if you have a variable named default-username
in your
environment, but create a new test and manually create
a test variable with the same name, the
test variable will be used and NOT the environment variable.
Furthermore, if you create a setup step which defines a
default-username
dynamic variable, it will override both the test
variable and environment variable with the same key.
Next steps
These new features are available today for all accounts. To get started, check out the documentation for environments. If you have any questions or comments, contact us any time - we'd love to hear from you!
This is just the start of many improvements we plan on making to Assertible. Have an idea for how we can improve the API testing experience? Shoot me a message on Twitter or reach out directly and let's chat!
Start testing your API for free
:: Christopher Reichert
Categories
The easiest way to test and
monitor your web services
Reduce bugs in web applications by using Assertible to create an automated QA pipeline that helps you catch failures & ship code faster.
Get started with GitHubSign up for freeRecent posts
Tips for importing and testing your API spec with Assertible 05/26/2020
New feature: Encrypted variables 10/30/2019
New feature: Smarter notifications 5/17/2019