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:
- Increase API test coverage by validating that the APIs meet your expectations for functionality, reliability, performance, and security.
- Augment your end-to-end browser tests to make them faster and more reliable.
Test Output for an API test
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 run API tests across environments later
- Create an API test in the API Test Editor. 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 as needed
- Automate running your API tests by adding to a plan that runs on a schedule or gets triggered by a deployment event
FAQs
How can I define my own API test?
Before creating your first API test, you'll need to configure your environment. Then, click on New test in the left-hand navigation and select API test to get started. See our guide on creating API tests for more details.
Can I edit the API tests that I've trained?
Yes! Like browser tests, API tests can be edited and updated by clicking on the Edit test button on the test details page.
How does mabl execute an API test in the cloud?
Mabl executes API tests using virtualized cloud infrastructure. The same logic used to execute API tests locally in the mabl desktop application is used to execute API tests in the cloud. Responses from your servers are captured and displayed in the test output page.
Do API tests support the same capabilities as browser tests?
At present, API tests in mabl do not support the following capabilities that are available for browser tests:
- Reusable flows
- JavaScript snippets
- API tests support mabl variable syntax, but they do not support other valid expressions: macros, faker values, and math expressions. However, you can use Postman dynamic variables in API tests thanks to the mabl integration with Postman.
Can I convert a Postman collection into a mabl API test?
Yes. Learn more about importing Postman collections into mabl here.
Do API test steps support file uploads?
Yes, you can follow these steps to upload a file in an API request.
Can API tests send requests to websockets?
No, API tests do not currently support testing websockets. If you have a use case requiring testing websockets, please let us know in the mabl Product Portal.