11/03/2017 Changelog Cody Reichert

Variables in Assertible are a key part of creating and running API tests with dynamic data. We're excited to announce a new variable autocomplete feature that makes configuring tests with variables easy and straightforward.

Building tests that rely on dynamic data is a common and important part of creating a robust API testing framework. In Assertible, the dynamic data are variables that can be used on a test and are substituted with the value of the variable when the test is run. This greatly simplifies re-using data between tests, injecting dynamic data, and working with environments.

The new variable autocomplete feature makes using variables and dynamic data simple and transparent. On any test configuration input, if you begin typing the variable syntax ({{) a popover will display all variables in-scope for the current test and allow you to select and autocomplete the one you need.

Variable autocomplete in Assertible

Each variable option in the popover gives you a few pieces of information:

  • Variable name
  • Scope (Test, Setup, Environment) (See: Variable precedence)
  • Current value (or if it's a setup, the selector)
  • If it's overridden by another variable

Being able to see what variables are available, and their current value, makes it faster to set up tests that rely on dynamic data, chain API requests, and create multi-step workflows. Below is a brief overview of using variables, but this feature is available now so feel free to log in or sign up and try it out!

Using variables

A test in Assertible can use variables in almost every part of its configuration. This is useful for creating more dyamic tests based on things like the current environment and setting up workflows to pass data between requests.

Variables can be defined in three places, listed in order of precedence:

When a variable is defined in one of the above locations, a test can access and use their value. Variables can be used in the following parts of a test configurations:

If a test uses a variable in any of those locations (eg, {{userId}} in a query parameter), Assertible will substitute the variable's value at run-time. If the variable is a test or environment variable, the value is known beforehand - it's static. If it's

defined by a setup, the setup step is executed every time the test is run, creating dynamic variables.

Test and environment variables are useful for cases where you need to define a value differently for a specific test or on each environment. Setup steps are more dynamic. For example, an HTTP request setup can make an API request and save data from the response as variables, which can then be passed between requests.

Future development

A primary goal at Assertible is to create a easy but powerful platform for testers and developers to create basic API monitoring or complex API test flows. Simplifying working with variables, setup steps, and tests in general, is a big part of reaching this goal, so a lot of future development will be spent on optimizing these workflows.

Is there a feature for tests or variables you'd like to see supported in Assertible? We'd love to hear from you. Send us a message or reach out on Twitter and let's talk!

:: Cody Reichert

Categories

The easiest way to test and
monitor your web services

Define and test your web service with Assertible Track and test API deployments across environments Schedule API monitoring and failure alerts

Reduce bugs in web applications by using Assertible to create an automated QA pipeline that helps you catch failures & ship code faster.

Sign up for free