Creating API tests
How to create API tests in mabl
This guide outlines how to set up a base API URL in your mabl workspace and create a new API test.
API testing is available to trial users and customers on enterprise subscription plans.
Configuring your environment
If the API URL has already been added to your mabl workspace, skip ahead to the section on creating a new API test. If not, you'll need to add a base URL for an API to an application in your mabl workspace:
- Navigate to Configuration > Applications.
- Click on the URL for a specific app/env. An edit modal will appear.
- Click Add URL.
- Choose API for the type and enter the base URL.
Omit the trailing slash
When you add a base API URL to an application/environment, leave out the trailing slash at the end of the URL. (For example, write
Omitting the slash allows for more readable requests when working in the API test editor:
- Click Save to confirm your changes. This update will create a variable called
api.urlfor that specific application/environment.
After adding a base API URL, you can create your first API test in mabl from scratch or import an existing Postman Collection.
Creating a new API test
Follow these steps to create a new API test:
- Click on the New test button in the left-hand navigation.
- Choose API test as the test type. A form to create a new API test will appear.
At a minimum, you must define the test name and the API under test.
A full list of configurations that can be applied to an API test follows:
- Test name: we recommend establishing a naming convention for tests with other members of your workspace so that you can easily locate tests and understand what they do.
- Test description: descriptions give more context or explanation for a test.
- Test labels: Useful for sorting and triggering ad hoc runs from the mabl CLI.
Add to plan
You may choose to add the test to an existing plan, create a new plan, or not add the test to a plan at all:
- Existing plan: Choose the plan from the dropdown. The test will use the application environment(s) that are configured for the existing plan.
- New plan: Enter the plan name and select the application and environment that the plan should run in.
- No plan: Select the application and environment for the test.
API URL required
It is not possible to add an API test to a plan or application that lacks a base API URL. To add an API URL to an application, see Configuring your environment.
Show advanced options
You can associate the API test with a DataTable. If you want to train an API test with a DataTable, follow the instructions outlined here.
Test size limits
After filling out the browser test creation form, click on Create test to open the API Test Editor and add steps!
Updated about 1 month ago