-
Notifications
You must be signed in to change notification settings - Fork 1
JSON API
MattRussellTTP edited this page Jul 15, 2015
·
5 revisions
Results can be uploaded to trt via a JSON HTTP API.
Fetch a list of tests stored in TRT. Parameters:
-
configuration: if not specified, will choose a default configuration. For example:
/api/tests?configuration=trunk -
status: if specified, just return tests in the given status (Healthy, Warning or Broken). For example:
/api/tests?status=Broken
For example:
curl -H "Content-Type: application/json" --data @batch.json http://localhost:9000/api/batches
batch.json:
{
"name": "Example batch",
"url": "http://www.example.com/",
"executionTime": 1409669831796,
"duration": 2234,
"executions": [
{
"test": {
"name": "First test",
"group": "Test suite"
},
"passed": true,
"summary": "Passed, no errors",
"log": "Log line 1\nlog line 2\nlog line 3",
"executionTime": 1409669831796,
"duration": 1234
},
{
"test": {
"name": "Second test",
"group": "Test suite"
},
"passed": false,
"summary": "Failed, some problem happened",
"log": "Log line 1\nlog line 2\nlog line 3",
"executionTime": 1409669831796,
"duration": 1000
}
]
}Test // a test case.
{
"name": String, // A name given to the test case.
"group": String (optional) // A group of tests to which this test case belongs (e.g. a test suite in JUnit)
}
Execution // the result of running a single test case
{
"test": Test,
"passed": Boolean,
"summary": String (optional, // A one-line summary of the test execution
"log": String (optional) , // A full log of the test execution
"executionTime": Integer (optional), // When the test ran (milliseconds since 1970). Defaults to the batch executionTime.
"duration": Integer (optional), // How long the test ran for (in milliseconds)
"configuration": String (optional) // If you run the same tests across multiple configurations (e.g. environments, web browsers, etc), you can distinguish them using this field. Defaults to "Default".
}
Batch // the results from a group of tests that have been run together (for example, as a job in Jenkins)
{
"executions": [ Execution ], // list of executions in the batch
"url": String (optional), // a URL associated with the run (for example, a build in Jenkins)
"name": String (optional), // Batch name
"log": String (optional), // A log associated with the entire batch of tests
"executionTime": Integer (optional), // When the batch ran (milliseconds since 1970). Defaults to the current time if not specified.
"duration": Integer (optional) // How long the batch ran for (in milliseconds)
}