Run Test Bot
Run test bot with JWT-based authentication for CI/CD pipelines
jwtToken (required)
JWT token for authentication. The token must contain:
organizationId - Organization identifier (required)
urlDetails - Array containing URL configuration with key assetServiceApiUrl (required)
- The
assetServiceApiUrl value is used to construct the service endpoint
projectId - Project identifier (optional, can also be provided in testBotConfiguration)
createdByUserId - User identifier for execution attribution (optional)
partnerId - Partner identifier (optional)
tokenType - Token type (optional)
JWT Token Format:
{
"organizationId": "c599bd03-9b32-46da-891a-267c351f207a",
"organizationName": "Your Organization",
"createdByUserId": "user-uuid-here",
"projectId": "project-uuid-here",
"partnerId": "partner-uuid-here",
"tokenType": "ORGANIZATION",
"iat": 1234567890,
"exp": 1234567890,
"urlDetails": [
{
"key": "assetServiceApiUrl",
"value": "https://api-dev.intelionsolutions.com/asset-services"
}
]
}
testBotConfiguration (required)
Stringified JSON configuration for the test bot. Must include at minimum:
testBotId - The ID of the test bot to execute (required)
Additional optional fields:
{
"testBotId": "string (required)",
"projectId": "string (optional, overrides JWT projectId)",
"name": "string (optional)",
"executionConfiguration": {
"browser": "string",
"browserVersion": "string",
"closeBrowserAfterEachExecution": "boolean",
"customProperties": [
{
"customPropertyId": "string",
"name": "string",
"value": "string"
}
],
"type": "string",
"gridId": "string",
"excludeToBeRepairedTest": "boolean",
"gridUrl": "string",
"gridUrlForExecution": "string",
"osType": "string",
"resolution": "string",
"screenshotAfterEachStep": "boolean",
"screenshotOnError": "boolean",
"screenshotOnFinish": "boolean",
"timeout": "number",
"waitForElementTimeout": "number"
}
}
Example Usage
- task: runTestBot@1.4.5
inputs:
jwtToken: '$(JWT_TOKEN)'
testBotConfiguration: '{"testBotId":"6d3879da-5bde-47d3-99c4-8639f0ce6e4a","name":"API Validation Test Bot"}'
How It Works
- Token Parsing: The task extracts
organizationId and assetServiceApiUrl from the JWT token's urlDetails array
- API Endpoint Construction: Constructs the API endpoint by:
- Extracting the base URL from
assetServiceApiUrl (e.g., https://api-dev.intelionsolutions.com from https://api-dev.intelionsolutions.com/asset-services)
- Appending the service path:
{baseUrl}/test-bot-executor-services
- Execution Trigger: Sends POST request to
/rest/api/testops/{testBotId}/execute with JWT authentication
- Status Monitoring: Polls for execution status every 5 seconds at
/rest/api/testops/execution/{executionId}/status
- Results Retrieval: Fetches detailed results from
/rest/api/testops/execution/{executionId}/detailed-results when execution completes
- Result Display: Displays comprehensive execution summary including:
- Test suites, scripts, and iterations
- Pass/fail counts
- Error messages and execution details
- Screenshot and video URLs (if available)
- Task Result: Sets Azure DevOps task result based on test bot execution outcome (Succeeded/Failed)
Features
- Bundled Dependencies: All npm dependencies are bundled into a single file, eliminating the need for
npm install during deployment
- Comprehensive Error Handling: Validates inputs and provides clear error messages
- Detailed Reporting: Displays execution results with status icons, timing information, and failure details
- Timeout Protection: Maximum polling time of 30 minutes to prevent indefinite waiting
- Flexible Configuration: Supports projectId from JWT token or testBotConfiguration
Technical Details
- Runtime: Node.js 10, 16, or 20.1
- Bundling: Uses tsup to bundle all dependencies
- Dependencies:
azure-pipelines-task-lib (bundled)
jwt-decode (bundled)
ofetch (bundled)