Using the REST API

Testmo's REST API is a typical HTTP-based API to access Testmo's data model and create/update objects. Before directly accessing the HTTP API from your scripts and integrations, consider using our popular Testmo CLI tool instead, as it provides an easy way to use the API and submit automation results without any custom programming.

Testmo CLI

Our Testmo CLI is the easiest option to use Testmo's API and implement test automation integrations, submit automated test results from your CI/CD pipeline and implement advanced workflows.
For example, it's very easy to submit your automated test results in JUnit XML format (supported by pretty much any test automation tool) from the command line or CI/CD workflow:
Full example
Single line
$ export TESTMO_TOKEN=********
$ testmo automation:run:submit \
--instance https://<your-name> \
--project-id 1 \
--name "New test run" \
--source "frontend" \
--results results/*.xml
If you run this example on a single command line, make sure to remove the backspaces:
$ export TESTMO_TOKEN=********
$ testmo automation:run:submit --instance https://<your-name> --project-id 1 --name "Test run" --source "unittests" --results results/*.xml
On Windows, the command line uses a slightly different syntax to set a variable:
> set TESTMO_TOKEN=********
> testmo automation:run:submit --instance https://<your-name> --project-id 1 --name "Test run" --source "unittests" --results results/*.xml
See command output
Collecting log files ..
Found 1 result file with a total of 855 tests
Created new automation run (ID: 254)
Created new thread (ID: 608)
Sending tests to Testmo ..
Uploading: [|||||||||||||||||||||||||] 100% | ETA: 0s | 855/855 tests
Successfully sent tests and completed run
Marked the run as completed
The Testmo CLI also supports advanced workflows such as parallel testing, custom fields, submitting artifacts etc. The Testmo CLI tool can also directly launch your automation tool to measure test times, record exit statuses and capture the complete console output. Make sure to review its full documentation here:

JavaScript / Node.js package

We also provide a ready-to-use Node.js package to make it easier to consume and call the API from your custom JavaScript code. The package is also used by the Testmo CLI tool, so it's always up-to-date. Here's a basic example on how to use the package:
var testmo = require('@testmo/testmo-api');
// Configure API client
const client = new testmo.ApiClient();
client.basePath = process.env.TESTMO_URL;
client.authentications['bearerAuth'].accessToken = process.env.TESTMO_TOKEN;
// Request current user
const api = new testmo.UserApi(client);
const user = await api.getCurrentUser();

HTTP API methods

You can also directly access Testmo's API from your custom scripts or command line if you prefer. To make it easier to consume the API, we also publish an OpenAPI schema to generate additional client libraries for more programming languages. Accessing the API is easy and you can directly call the HTTP methods and passing the authentication token:
$ TESTMO_TOKEN=********
$ curl -H "Authorization: Bearer $TESTMO_TOKEN" \
You can learn more about authenticating with the API and generating API keys in Testmo's user interface.