API testing overview

In addition to using API steps within your end-to-end browser tests, you can also use mabl to work with web requests and automate end-to-end tests for your application programming interfaces (APIs). Unlike UI tests that need to interact with a browser, API tests are performed at message layer (e.g. http protocol) and therefore, run much faster than browser tests, completing in seconds, not minutes.

Use cases

You can use the API testing capabilities in mabl to achieve the following:

  • Augment your end-to-end browser tests to make them more reliable and faster
    • Quickly and reliably set up/tear down test data that browser tests will rely on
    • Share data between UI and API tests within the same plan using shared variables
  • Increase API test coverage by validating that the APIs meet your expectations for functionality, reliability, performance, and security.
mabl API test run results.mabl API test run results.

mabl API test run results.

Your workflow

At a high level you will typically take the following steps when working with API tests in mabl:

  • Configure your mabl environments with API URLs so that you can easily run API tests across environments later
  • Use the mabl desktop app to create your API requests. If you have existing Postman Collections, you can import them into mabl.
  • Run your API tests and review the results
  • Make updates to your API tests in the desktop app
  • Automate running your API tests on schedule or on a deployment event

Configure your environment

Before creating and running API tests, we recommend that you configure your mabl environment by adding a base URL for the API endpoints. You can do so from the Configuration -> Applications section of your mabl workspace.

Adding an API host URL to a mabl environment.Adding an API host URL to a mabl environment.

Adding an API host URL to a mabl environment.

This configuration allows you to use a variable called api.url when composing the full URL for your API requests (e.g. {{@api.url}}/api/users) so that you can easily run the tests across environments such as development, staging, and production.

You can now create your first API test in mabl from scratch or import an existing Postman Collection.

What counts against my API testing allotment?

Any API test that's run in the cloud and any individual API step within a browser test (that is also run in the cloud), will count against your allotment. Local runs of both API and browser tests do not impact your allotment in any way.

Did this page help you?