-
Notifications
You must be signed in to change notification settings - Fork 20
Cuanto JSON API
The Cuanto Java API and Ant task are included in the Cuanto download.
HTTP POST to http://<cuantourl>/api/addTestRun
{
"valid":true,
"dateExecuted":"2010-08-23T05:47:11.494-0700",
"testProperties":{
"Computer":"Apple",
"Radio":"KEXP"
},
"links":{
"http://bar":"BAR",
"http://foo":"FOO"
},
"note":"My note",
"projectKey":"ClientTest"
}
Response: 201 Created
{
"id":4933,
"dateCreated":"2010-08-23T05:47:11.759-0700",
"dateExecuted":"2010-08-23T05:47:11.494-0700",
"lastUpdated":"2010-08-23T05:47:11.759-0700",
"valid":true,
"project":{
"id":125,
"name":"ClientTest",
"projectGroup":{
"name":"Sample",
"id":9
},
"projectKey":"ClientTest",
"bugUrlPattern":"",
"testType":{
"name":"JUnit",
"id":1
}
},
"note":"My note",
"links":{
"http://bar":"BAR",
"http://foo":"FOO"
},
"testProperties":[
{
"name":"Computer",
"value":"Apple"
},
{
"name":"Radio",
"value":"KEXP"
}
]
}
HTTP GET from http://<cuantourl>/api/getTestRun/<testRunId>
Response: 200 OK
{
"id":4933,
"dateCreated":"2010-08-23T05:47:11.000-0700",
"dateExecuted":"2010-08-23T05:47:11.000-0700",
"lastUpdated":"2010-08-23T05:47:11.000-0700",
"valid":true,
"project":{
"id":125,
"name":"ClientTest",
"projectGroup":{
"name":"Sample",
"id":9
},
"projectKey":"ClientTest",
"bugUrlPattern":"",
"testType":{
"name":"JUnit",
"id":1
}
},
"note":"My note",
"links":{
"http://bar":"BAR",
"http://foo":"FOO"
},
"testProperties":[
{
"name":"Computer",
"value":"Apple"
},
{
"name":"Radio",
"value":"KEXP"
}
]
}
Returns TestRuns that match all of the specified properties. Note this will return test runs that include additional properties beyond the ones specified, but will not return test runs that do not contain all of the specified properties.
HTTP POST to http://<cuantourl>/api/getTestRunsWithProperties
Post body:
{
"testProperties":{
"desserts":"although alternatives"
},
"projectKey":"ClientTest"
}
Response: 200 OK or 404 NOT FOUND
{
"testRuns":[
{
"id":5118,
"dateCreated":"2010-08-24T12:28:24.000-0700",
"dateExecuted":"2010-08-26T12:28:23.000-0700",
"lastUpdated":"2010-08-24T12:28:24.000-0700",
"valid":true,
"project":{
"id":125,
"name":"ClientTest",
"projectGroup":{
"name":"Sample",
"id":9
},
"projectKey":"ClientTest",
"bugUrlPattern":"",
"testType":{
"name":"JUnit",
"id":1
}
},
"note":null,
"links":{
},
"testProperties":[
{
"name":"desserts",
"value":"although alternatives"
},
{
"name":"Poppyseed",
"value":"I"
},
{
"name":"really",
"value":"Day"
},
{
"name":"recipe",
"value":"lessons"
}
]
},
{
"id":5117,
"dateCreated":"2010-08-24T12:28:23.000-0700",
"dateExecuted":"2010-08-25T12:28:23.000-0700",
"lastUpdated":"2010-08-24T12:28:23.000-0700",
"valid":true,
"project":{
"id":125,
"name":"ClientTest",
"projectGroup":{
"name":"Sample",
"id":9
},
"projectKey":"ClientTest",
"bugUrlPattern":"",
"testType":{
"name":"JUnit",
"id":1
}
},
"note":null,
"links":{
},
"testProperties":[
{
"name":"desserts",
"value":"although alternatives"
},
{
"name":"Poppyseed",
"value":"might from"
},
{
"name":"really",
"value":"looking recipes"
},
{
"name":"recipe",
"value":"much"
}
]
}
]
}
Returns all TestRuns for a project in descending order by dateExecuted.
HTTP GET from http://<cuantourl>/api/getAllTestRuns?projectKey=<projectKey>
Response: 200 OK
{
"testRuns":[
{
"id":4948,
"dateCreated":"2010-08-23T06:32:05.000-0700",
"dateExecuted":"2010-08-26T06:32:04.000-0700",
"lastUpdated":"2010-08-23T06:32:05.000-0700",
"valid":true,
"project":{
"id":125,
"name":"ClientTest",
"projectGroup":{
"name":"Sample",
"id":9
},
"projectKey":"ClientTest",
"bugUrlPattern":"",
"testType":{
"name":"JUnit",
"id":1
}
},
"note":"third run",
"links":{
"http://build/3":"build artifacts"
},
"testProperties":[
{
"name":"greeting",
"value":"Hola"
}
]
},
{
"id":4947,
"dateCreated":"2010-08-23T06:32:04.000-0700",
"dateExecuted":"2010-08-25T06:32:03.000-0700",
"lastUpdated":"2010-08-23T06:32:04.000-0700",
"valid":true,
"project":{
"id":125,
"name":"ClientTest",
"projectGroup":{
"name":"Sample",
"id":9
},
"projectKey":"ClientTest",
"bugUrlPattern":"",
"testType":{
"name":"JUnit",
"id":1
}
},
"note":"second run",
"links":{
"http://build/2":"build artifacts"
},
"testProperties":[
{
"name":"greeting",
"value":"Bonjour"
}
]
},
{
"id":4946,
"dateCreated":"2010-08-23T06:32:03.000-0700",
"dateExecuted":"2010-08-24T06:32:02.000-0700",
"lastUpdated":"2010-08-23T06:32:03.000-0700",
"valid":true,
"project":{
"id":125,
"name":"ClientTest",
"projectGroup":{
"name":"Sample",
"id":9
},
"projectKey":"ClientTest",
"bugUrlPattern":"",
"testType":{
"name":"JUnit",
"id":1
}
},
"note":"first run",
"links":{
"http://build/1":"build artifacts"
},
"testProperties":[
{
"name":"greeting",
"value":"Hello"
}
]
}
]
}
HTTP POST to http://<cuantourl>/api/updateTestRun/<testRunId>
{
"id":4934,
"valid":true,
"dateExecuted":"2010-08-23T06:12:57.760-0700",
"testProperties":{
"Twin":"Peaks",
"Computer":"Mac"
},
"links":{
"http://blahblah":"Blah",
"http://foo":"UPDATED foo"
},
"note":"new note",
"projectKey":"ClientTest"
}
Response: 200 OK
TestRun updated
HTTP POST to http://<cuantourl>/api/deleteTestRun/<testRunId>
Response: 200 OK
Deleted TestRun
HTTP POST to http://<cuantourl>/api/addTestOutcome
{
"result":"Fail",
"isFailureStatusChanged":null,
"startedAt":"2010-08-23T07:38:37.773-0700",
"projectKey":"ClientTest",
"id":null,
"duration":86400000,
"analysisState":"Bug",
"testOutput":"Fantastic test output",
"finishedAt":"2010-08-24T07:38:37.773-0700",
"owner":"Cuanto",
"testRun":{
"id":4949,
"valid":true,
"dateExecuted":"2010-08-23T07:38:37.850-0700",
"projectKey":"ClientTest"
},
"bug":{
"id":null,
"title":"MyBug",
"url":"http://jira.codehaus.org/CUANTO-1"
},
"testCase":{
"id":null,
"testName":"testAddTestOutcome",
"packageName":"org.codehaus.cuanto",
"description":null,
"parameters":"my parameters"
},
"note":"Cuanto note"
}
Response: 201 Created
{
"id":2232514,
"analysisState":{
"name":"Bug",
"id":2
},
"testCase":{
"testName":"testAddTestOutcome",
"packageName":"org.codehaus.cuanto",
"parameters":"my parameters",
"description":null,
"id":86786,
"fullName":"org.codehaus.cuanto.testAddTestOutcome"
},
"result":"Fail",
"owner":"Cuanto",
"note":"Cuanto note",
"duration":86400000,
"testRun":{
"id":4949,
"dateCreated":"2010-08-23T07:38:38.000-0700",
"dateExecuted":"2010-08-23T07:38:37.000-0700",
"lastUpdated":"2010-08-23T07:38:38.000-0700",
"valid":true,
"project":{
"id":125,
"name":"ClientTest",
"projectGroup":{
"name":"Sample",
"id":9
},
"projectKey":"ClientTest",
"bugUrlPattern":"",
"testType":{
"name":"JUnit",
"id":1
}
},
"note":null,
"links":{
},
"testProperties":[
]
},
"dateCreated":"2010-08-23T07:38:38.597-0700",
"lastUpdated":"2010-08-23T07:38:38.597-0700",
"isFailureStatusChanged":false,
"bug":{
"title":"MyBug",
"url":"http://jira.codehaus.org/CUANTO-1",
"id":652
},
"startedAt":"2010-08-23T07:38:37.773-0700",
"finishedAt":"2010-08-24T07:38:37.773-0700"
}
HTTP GET from http://<cuantourl>/api/getTestOutcome/<testOutcomeId>
Response: 200 OK
{
"id":2232514,
"analysisState":{
"name":"Bug",
"id":2
},
"testCase":{
"testName":"testAddTestOutcome",
"packageName":"org.codehaus.cuanto",
"parameters":"my parameters",
"description":null,
"id":86786,
"fullName":"org.codehaus.cuanto.testAddTestOutcome"
},
"result":"Fail",
"owner":"Cuanto",
"note":"Cuanto note",
"duration":86400000,
"testRun":{
"id":4949,
"dateCreated":"2010-08-23T07:38:38.000-0700",
"dateExecuted":"2010-08-23T07:38:37.000-0700",
"lastUpdated":"2010-08-23T07:38:38.000-0700",
"valid":true,
"project":{
"id":125,
"name":"ClientTest",
"projectGroup":{
"name":"Sample",
"id":9
},
"projectKey":"ClientTest",
"bugUrlPattern":"",
"testType":{
"name":"JUnit",
"id":1
}
},
"note":null,
"links":{
},
"testProperties":[
]
},
"dateCreated":"2010-08-23T07:38:38.000-0700",
"lastUpdated":"2010-08-23T07:38:38.000-0700",
"isFailureStatusChanged":false,
"bug":{
"title":"MyBug",
"url":"http://jira.codehaus.org/CUANTO-1",
"id":652
},
"startedAt":"2010-08-23T07:38:37.000-0700",
"finishedAt":"2010-08-24T07:38:37.000-0700"
}
HTTP GET from http://<cuantourl>/api/getTestOutput/<testOutcomeId>
Response: 200 OK
The body of the response is the full output:
Fantastic test output
HTTP POST to http://<cuantourl>/api/updateTestOutcome
{
"result":"Fail",
"startedAt":"2010-08-23T08:30:39.152-0700",
"projectKey":"ClientTest",
"id":2232521,
"duration":172800000,
"analysisState":"Other",
"testOutput":"Stupendous test output",
"finishedAt":"2010-08-25T08:30:39.152-0700",
"owner":"New Cuanto",
"bug":{
"title":"MyOtherBug",
"url":"http://jira.codehaus.org/CUANTO-2"
},
"testRun":{
"id":4956,
"valid":true,
"dateExecuted":"2010-08-23T08:30:38.260-0700",
"projectKey":"ClientTest"
},
"note":"New Cuanto note"
}
Response: 200 OK
TestRun updated
HTTP GET from http://<cuantourl>/api/countTestOutcomes?id=<testRunId>
Response: 200 OK
{"count":202}
This fetches TestOutcomes that are associated with a particular TestRun. You can fetch a maximum of 100 TestOutcomes at a time.
HTTP GET from http://<cuantourl>/api/getTestOutcomes?id=<testRunId>&sort=fullName&sort=dateCreated&order=asc&order=asc&max=100&offset=0
Parameters:
- sort - Multiple sorts and multiple orders may be specified, the first one listed is the primary sort and the latter are secondary sorts. Valid sorts are fullName, testResult, state (analysis state), duration, bug (bug title), owner, note, testOutput, dateCreated, finishedAt, lastUpdated, startDate, dateExecuted.
- order - asc or desc
- max - maximum number of TestOutcomes to return.
- offset - offset of TestOutcomes to return. 0-based.
Response: 200 OK
{
"testOutcomes":[
{
"id":2274874,
"analysisState":{
"name":"Bug",
"id":2
},
"testCase":{
"testName":"testAddTestOutcome",
"packageName":"org.codehaus.cuanto",
"parameters":"my parameters",
"description":null,
"fullName":"org.codehaus.cuanto.testAddTestOutcome",
"id":86786
},
"result":"Fail",
"owner":"Cuanto",
"note":"Cuanto note",
"duration":86400000,
"testRun":{
"id":5107,
"dateCreated":"2010-08-24T06:15:21.000-0700",
"dateExecuted":"2010-08-24T06:15:21.000-0700",
"lastUpdated":"2010-08-24T06:15:21.000-0700",
"valid":true,
"project":{
"id":125,
"name":"ClientTest",
"projectGroup":{
"name":"Sample",
"id":9
},
"projectKey":"ClientTest",
"bugUrlPattern":"",
"testType":{
"name":"JUnit",
"id":1
}
},
"note":null,
"links":{
},
"testProperties":[
]
},
"dateCreated":"2010-08-24T06:15:22.000-0700",
"lastUpdated":"2010-08-24T06:15:22.000-0700",
"isFailureStatusChanged":false,
"bug":{
"title":"MyBug",
"url":"http://jira.codehaus.org/CUANTO-1",
"id":652
},
"startedAt":"2010-08-24T06:15:21.000-0700",
"finishedAt":"2010-08-25T06:15:21.000-0700"
},
{
"id":2274875,
"analysisState":{
"name":"Bug",
"id":2
},
"testCase":{
"testName":"testAnother",
"packageName":"org.codehaus.cuanto",
"parameters":"my parameters",
"description":null,
"fullName":"org.codehaus.cuanto.testAnother",
"id":86790
},
"result":"Fail",
"owner":"Cuanto Two",
"note":"Cuanto note two",
"duration":86400000,
"testRun":{
"id":5107,
"dateCreated":"2010-08-24T06:15:21.000-0700",
"dateExecuted":"2010-08-24T06:15:21.000-0700",
"lastUpdated":"2010-08-24T06:15:21.000-0700",
"valid":true,
"project":{
"id":125,
"name":"ClientTest",
"projectGroup":{
"name":"Sample",
"id":9
},
"projectKey":"ClientTest",
"bugUrlPattern":"",
"testType":{
"name":"JUnit",
"id":1
}
},
"note":null,
"links":{
},
"testProperties":[
]
},
"dateCreated":"2010-08-24T06:15:23.000-0700",
"lastUpdated":"2010-08-24T06:15:23.000-0700",
"isFailureStatusChanged":true,
"bug":{
"title":"MyBugTwo",
"url":"http://jira.codehaus.org/CUANTO-2",
"id":653
},
"startedAt":"2010-08-25T06:15:21.000-0700",
"finishedAt":"2010-08-26T06:15:21.000-0700"
}
]
}
This fetches all TestOutcomes for a particular TestCase, regardless of which (if any) TestRun they are associated with.
HTTP GET from http://<cuantourl>/api/getTestOutcomes?testCase=<testCaseId>&sort=dateCreated&order=desc&sort=finishedAt&order=desc
Parameters:
- testCase - The id of the TestCase
- sort - Multiple sorts and multiple orders may be specified, the first one listed is the primary sort and the latter are secondary sorts. Valid sorts are fullName, testResult, state (analysis state), duration, bug (bug title), owner, note, testOutput, dateCreated, finishedAt, lastUpdated, startDate, dateExecuted.
- order - asc or desc
Response: 200 OK
{
"testOutcomes":[
{
"id":2274879,
"analysisState":{
"name":"Bug",
"id":2
},
"testCase":{
"testName":"testAddTestOutcome",
"packageName":"org.codehaus.cuanto",
"parameters":"my parameters",
"description":null,
"fullName":"org.codehaus.cuanto.testAddTestOutcome",
"id":86786
},
"result":"Fail",
"owner":"Cuanto Two",
"note":"Cuanto note two",
"duration":86400000,
"testRun":null,
"dateCreated":"2010-08-24T07:33:10.000-0700",
"lastUpdated":"2010-08-24T07:33:10.000-0700",
"isFailureStatusChanged":false,
"bug":{
"title":"MyBugTwo",
"url":"http://jira.codehaus.org/CUANTO-2",
"id":653
},
"startedAt":"2010-08-25T07:33:07.000-0700",
"finishedAt":"2010-08-26T07:33:07.000-0700"
},
{
"id":2274878,
"analysisState":{
"name":"Bug",
"id":2
},
"testCase":{
"testName":"testAddTestOutcome",
"packageName":"org.codehaus.cuanto",
"parameters":"my parameters",
"description":null,
"fullName":"org.codehaus.cuanto.testAddTestOutcome",
"id":86786
},
"result":"Fail",
"owner":"Cuanto",
"note":"Cuanto note",
"duration":86400000,
"testRun":null,
"dateCreated":"2010-08-24T07:33:08.000-0700",
"lastUpdated":"2010-08-24T07:33:08.000-0700",
"isFailureStatusChanged":false,
"bug":{
"title":"MyBug",
"url":"http://jira.codehaus.org/CUANTO-1",
"id":652
},
"startedAt":"2010-08-24T07:33:07.000-0700",
"finishedAt":"2010-08-25T07:33:07.000-0700"
},
{
"id":2273251,
"analysisState":{
"name":"Bug",
"id":2
},
"testCase":{
"testName":"testAddTestOutcome",
"packageName":"org.codehaus.cuanto",
"parameters":"my parameters",
"description":null,
"fullName":"org.codehaus.cuanto.testAddTestOutcome",
"id":86786
},
"result":"Fail",
"owner":"Cuanto Two",
"note":"Cuanto note two",
"duration":86400000,
"testRun":null,
"dateCreated":"2010-08-23T13:21:18.000-0700",
"lastUpdated":"2010-08-23T13:21:18.000-0700",
"isFailureStatusChanged":false,
"bug":{
"title":"MyBugTwo",
"url":"http://jira.codehaus.org/CUANTO-2",
"id":653
},
"startedAt":"2010-08-24T13:21:16.000-0700",
"finishedAt":"2010-08-25T13:21:16.000-0700"
}
]
}
This fetches all TestOutcomes for a specific TestCase and TestRun -- under normal circumstances, there will only be one TestOutcome for a specific TestCase in one TestRun, so expect one result returned.
HTTP GET from: http://<cuantourl>/api/getTestCaseOutcomesForTestRun?testRun=<testRunId>&testCase=<testCaseId>
Response: 200 OK
{
"testOutcomes":[
{
"id":2274884,
"analysisState":{
"name":"Bug",
"id":2
},
"testCase":{
"testName":"testAddTestOutcome",
"packageName":"org.codehaus.cuanto",
"parameters":"my parameters",
"description":null,
"fullName":"org.codehaus.cuanto.testAddTestOutcome",
"id":86786
},
"result":"Fail",
"owner":"Cuanto Two",
"note":"Cuanto note two",
"duration":86400000,
"testRun":{
"id":5111,
"dateCreated":"2010-08-24T12:14:41.000-0700",
"dateExecuted":"2010-08-24T12:14:40.000-0700",
"lastUpdated":"2010-08-24T12:14:41.000-0700",
"valid":true,
"project":{
"id":125,
"name":"ClientTest",
"projectGroup":{
"name":"Sample",
"id":9
},
"projectKey":"ClientTest",
"bugUrlPattern":"",
"testType":{
"name":"JUnit",
"id":1
}
},
"note":null,
"links":{
},
"testProperties":[
]
},
"dateCreated":"2010-08-24T12:14:41.000-0700",
"lastUpdated":"2010-08-24T12:14:41.000-0700",
"isFailureStatusChanged":false,
"bug":{
"title":"MyBugTwo",
"url":"http://jira.codehaus.org/CUANTO-2",
"id":653
},
"startedAt":"2010-08-25T12:14:40.000-0700",
"finishedAt":"2010-08-26T12:14:40.000-0700"
}
]
}
HTTP GET: http://<cuantourl>/api/getTestCase?projectKey=<projectKey>&packageName=<testPackageName>&testName=<testName>¶meters=<parameters>
Parameters:
- packageName - the package name of the test. This is everything up to the actual test name (minus the period separating a test class from the test name).
- testName - the name of the test.
- parameters (optional) - Any parameters of the test. Parameters are part of the test case signature, so if you don't include parameters it will only match the TestCase if the packageName and testName match and the test has no parameters. If you include parameters, all three have to match for the TestCase to be considered a match.
Response: 200 OK or 404 NOT FOUND
{
"class":"cuanto.TestCase",
"id":86786,
"project":{
"class":"Project",
"id":125
},
"testName":"testAddTestOutcome",
"packageName":"org.codehaus.cuanto",
"description":null,
"parameters":"my parameters",
"fullName":"org.codehaus.cuanto.testAddTestOutcome"
}