Overview
The Thunders API provides a powerful endpoint for executing automated browser-based tests. This document explains how to use the /api/test-cases/run or /api/test-sets/run endpoint, which allows you to trigger test case execution programmatically, including through GitHub Actions workflows.
API Endpoints
POST <https://api.thunders.ai/api/test-cases/run>
POST <https://api.thunders.ai/api/test-sets/run>
Authentication
The API requires authentication using a Bearer token:
Authorization: Bearer YOUR_THUNDER_TEST_TOKEN
You must obtain a valid API token from the Thunders platform. This token should be stored securely as a secret in your environment or GitHub repository.
Headers
Header | Value | Description |
|
| Authentication token |
|
| Indicates a machine-to-machine API call |
|
| Specifies the request body format |
Request Body for Test Case Run
The request body must be a JSON object with the following properties:
{
"ProjectId": "c8e34ec4-2464-43c7-8db8-1b3a47a22337",
"TestCaseIds": ["a836fadc-377a-46fe-96b0-21f37c626bf9", "61015c47-612f-47fa-82a6-41d910832c1b", "8eea2fd3-da6d-4434-a310-176be84c5646"], "EnvironmentId": "eca24252-e566-40a8-b2b0-707b7efa85d8",
"PersonaId": "70d0ac52-fe94-4d89-aba9-8ef28dd8c04c",
"BrowserSettings": { "Location": "SanFrancisco", "Resolution": "1440x900", "DeviceType": "Desktop" }
}Parameters
Parameter | Type | Required | Default | Description |
|
| Yes | - | The unique identifier of the project containing the test cases. |
|
| Yes | - | Array of test case identifiers to execute. |
|
| Yes | - | The unique identifier of the environment to use. |
|
| Yes | - | The unique identifier of the persona to use when executing the tests |
|
| No |
| Geolocation cluster for the browser session. |
|
| No |
| Type of browser to use for the test execution |
|
| No |
| Type of device to emulate during test execution |
|
| No |
| Browser viewport resolution in pixels, in the format "widthxheight" |
|
| No |
| Enable or disable JavaScript execution in the browser. Note that some test steps rely on this option being set to true. |
|
| No |
| Whether to ignore HTTPS errors during navigation |
|
| No |
| Enable or disable dark theme for the browser |
|
| No |
| Enable measures to avoid bot detection during test execution |
|
| No | - | Scale factor for the device screen |
|
| No | - | Force specific color scheme for accessibility testing |
|
| No | - | Browser locale setting (e.g., "en-US", "fr-FR") |
|
| No | - | Username for authentication |
|
| No | - | Password for authentication |
|
| No | - | Proxy server configuration |
|
| No | - | Custom HTTP headers to include in requests |
Request Body for Test Set Run
The request body must be a JSON object with the following properties:
{ "ProjectId": "c8e34ec4-2464-43c7-8db8-1b3a47a22337",
"TestSetIds": ["a836fadc-377a-46fe-96b0-21f37c626bf9", "61015c47-612f-47fa-82a6-41d910832c1b", "8eea2fd3-da6d-4434-a310-176be84c5646"], "EnvironmentId": "eca24252-e566-40a8-b2b0-707b7efa85d8",
"PersonaId": "70d0ac52-fe94-4d89-aba9-8ef28dd8c04c",
"BrowserSettings": { "Location": "SanFrancisco", "resolution": "1440x900", }
}Parameters
Parameter | Type | Required | Default | Description |
|
| Yes | - | The unique identifier of the project containing the test cases. |
|
| Yes | - | Array of test set identifiers to execute. |
|
| Yes | - | The unique identifier of the environment to use. |
|
| Yes | - | The unique identifier of the persona to use when executing the tests |
|
| No |
| Geolocation cluster for the browser session. |
|
| No |
| Type of browser to use for the test execution |
|
| No |
| Type of device to emulate during test execution |
|
| No |
| Browser viewport resolution in pixels, in the format "widthxheight" |
|
| No |
| Enable or disable JavaScript execution in the browser. Note that some test steps rely on this option being set to true. |
|
| No |
| Whether to ignore HTTPS errors during navigation |
|
| No |
| Enable or disable dark theme for the browser |
|
| No |
| Enable measures to avoid bot detection during test execution |
|
| No | - | Scale factor for the device screen |
|
| No | - | Force specific color scheme for accessibility testing |
|
| No | - | Browser locale setting (e.g., "en-US", "fr-FR") |
|
| No | - | Username for authentication |
|
| No | - | Password for authentication |
|
| No | - | Proxy server configuration |
|
| No | - | Custom HTTP headers to include in requests |
Response
The API returns a response with details about the test execution. The exact format may vary depending on the test results, but typically includes:
Test execution status
Test results summary
Detailed results for each test case
Any errors or failures encountered
Error Handling
The API uses standard HTTP status codes to indicate success or failure:
200 OK: The request was successful, and the tests were executed400 Bad Request: The request was malformed or missing required parameters401 Unauthorized: Authentication failed or token is invalid403 Forbidden: The authenticated user does not have permission to execute the specified tests404 Not Found: One or more of the specified resources (project, test cases, environment, or persona) were not found500 Internal Server Error: An unexpected error occurred on the server
Using with GitHub Actions
You can easily integrate the Thunder Code API with your GitHub Actions workflows to automate test execution as part of your CI/CD pipeline.
Example GitHub Action Workflow
name: Run Thunders Test Cases
on:
workflow_dispatch: # This allows manual triggering from the GitHub UI
# You can add other triggers here as needed, such as:
# push:
# branches: [ main ]
# schedule:
# - cron: '0 0 * * *' # Run daily at midnight
jobs:
run-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Run Thunders API Test Cases
id: run-tests
uses: fjogeleit/http-request-action@v1
with:
url: '<https://api.thunders.ai/api/test-cases/run>'
method: 'POST'
customHeaders: >
{
"Authorization": "Bearer ${{ secrets.THUNDER_TEST_TOKEN }}",
"X-MS-API-ROLE": "M2M",
"Content-Type": "application/json"
}
data: >
{
"ProjectId": "c8e34ec4-2464-43c7-8db8-1b3a47a22337",
"TestCaseIds": ["a836fadc-377a-46fe-96b0-21f37c626bf9", "61015c47-612f-47fa-82a6-41d910832c1b", "8eea2fd3-da6d-4434-a310-176be84c5646"],
"EnvironmentId": "eca24252-e566-40a8-b2b0-707b7efa85d8",
"PersonaId": "70d0ac52-fe94-4d89-aba9-8ef28dd8c04c"
}
- name: Output API Response
if: ${{ success() }}
run: echo "API Response - ${{ steps.run-tests.outputs.response }}"
Setting Up GitHub Secrets
To use the Thunders API in your GitHub Actions workflow, you need to set up a secret for your API token:
Go to your GitHub repository
Navigate to Settings > Secrets and variables > Actions
Click "New repository secret"
Name:
THUNDER_TEST_TOKENValue: Your Thunders API token
Click "Add secret"
Customizing the Workflow
You can customize the workflow by:
Changing the trigger events (e.g., on push, on schedule)
Modifying the test parameters (ProjectId, TestCaseIds, TestSetIds, EnvironmentId, PersonaId)
Adding additional steps to process the test results


