You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

Settings

Some settings can be exported using the REST API.

This page provides a list of the available endpoints available for managing Xray related settings.


Test Statuses

  • To obtain a list of all Test (Run) Statuses, including the default ones, you just need to invoke the following endpoint:


Returns a JSON object with all the Test (Run) Statuses.

Request


Example Request

curl -H "Content-Type: application/json" -X GET -u admin:admin http://yourserver/rest/raven/1.0/api/settings/teststatuses

Responses

200 OK : application/json : Successful. Returns a JSON with all the Test (Run) Statuses along with some information, including name, description, ranking and mapping to the requirement status.

Example Output
[
 {
   "id": 1,
   "rank": 1,
   "name": "PASS",
   "description": "The test run has passed",
   "final": true,
   "color":"#0a9600",
   "requirementStatusName": "OK"
 },
 {
   "id": 10,
   "rank": 10,
   "name": "BLOCKED",
   "description": "The test run is blocked"
   "final": false,
   "color": "#000000",
   "requirementStatusName": "NOTRUN"
 }
 ...
]

400 BAD_REQUEST : text/plain : Returns the error.

401 UNAUTHORIZED : text/plain : The Xray license is not valid.

500  INTERNAL SERVER ERROR : text/plain : An internal error occurred getting the test statuses.

Return a json that represents the test run.

Request

QUERY PARAMETERS
parametertypedescription
testExecIssueKeyString

- key of the Test Execution.

testIssueKeyStringkey of the Test Issue.

Example Request

curl -H "Content-Type: application/json" -X GET -u admin:admin http://yourserver/rest/raven/1.0/api/testrun?testExecIssueKey=TEST-123&testIssueKey=TEST-321


Responses

200 OK : text/plain : Successful. Return a json that represents the test run.

Example Output
{
   "id":371,
   "status":"TODO",
   "testKey":"CALC-12",
   "testExecKey":"CALC-13",
   "assignee":"admin",
   "executedBy":"admin",
   "startedOn":"2016-10-24T15:50:57+01:00",
   "defects":[
      {
         "id":15017,
         "key":"test-114",
         "summary":"summary 1",
         "status":"Open"
      },
      {
         "id":15018,
         "key":"test-115",
         "summary":"summary 2",
         "status":"Open"
      }
   ],
   "evidences":[
      {
         "id":313,
         "fileName":"stuff.txt",
         "fileSize":"0,0 kB",
         "created":"2016-10-24T15:50:57+01:00",
         "author":"admin",
         "fileURL":"http://lenovo-pc:2990/jira/plugins/servlet/raven/attachment/313/stuff.txt"
      },
      {
         "id":314,
         "fileName":"stuff2.txt",
         "fileSize":"0,0 kB",
         "created":"2016-10-24T15:50:57+01:00",
         "author":"admin",
         "fileURL":"http://lenovo-pc:2990/jira/plugins/servlet/raven/attachment/314/stuff2.txt"
      }
   ],
   "comment":"new comment",
   "scenarioOutline":"Given I have entered <input_1> into the calculator\r\nAnd I have entered <input_2> into the calculator\r\nWhen I press <button>\r\nThen the result should be <output> on the screen\r\n\r\n  Examples:\r\n    | input_1 | input_2 | button | output |\r\n    | 20      | 30      | add    | 50     |\r\n    | 2       | 5       | add    | 7      |\r\n    | 0       | 40      | add    | 40     |",
   "examples":[
      {
         "id":1377,
         "rank":0,
         "values":[
            "input_1",
            "input_2",
            "button",
            "output"
         ],
         "status":"PASS",
         "statusDescription":"The test run has passed"
      },
      {
         "id":1378,
         "rank":1,
         "values":[
            "20",
            "30",
            "add",
            "50"
         ],
         "status":"PASS",
         "statusDescription":"The test run has passed"
      },
      {
         "id":1379,
         "rank":2,
         "values":[
            "2",
            "5",
            "add",
            "7"
         ],
         "status":"PASS",
         "statusDescription":"The test run has passed"
      },
      {
         "id":1380,
         "rank":3,
         "values":[
            "0",
            "40",
            "add",
            "40"
         ],
         "status":"PASS",
         "statusDescription":"The test run has passed"
      }
   ],
   "environments" : [
	  "IOS",
	  "Android"
	  ]
}

400 BAD_REQUEST : text/plain : Returns the error.

401 UNAUTHORIZED : text/plain : The Xray license is not valid.

500  INTERNAL SERVER ERROR : text/plain : An internal error occurred getting the test run.

Update the test run. The fields that can be updated on the test run are: status, comment, defects, evidences, examples and steps.

Request

PATH PARAMETERS
parametertypedescription
idinteger

- ID of the test run.

Example
Example Input 1
{
	"status": "FAIL",
	"comment": "new comment",
	"defects": {
		"add": [
			"test-114",
			"test-115",
			"test-116"
		]
	},
	"evidences": {
		"add": [{
			"filename": "test1.txt",
			"contentType": "plain/text",
			"data": "(base64 encoding...)"
		}, {
			"filename": "test2.txt",
			"contentType": "plain/text",
			"data": "(base64 encoding...)"
		}],
		"remove": ["254", "443"]
	},
	"examples": [{
		"id": "1379",
		"status": "TODO"
	}]
}

 

Example Input 2
{
	"status": "FAIL",
	"comment": "new comment",
	"defects": {
		"add": [
			"test-114",
			"test-115",
			"test-116"
		]
	},
	"evidences": {
		"add": [{
			"filename": "test1.txt",
			"contentType": "plain/text",
			"data": "(base64 encoding...)"
		}, {
			"filename": "test2.txt",
			"contentType": "plain/text",
			"data": "(base64 encoding...)"
		}],
		"remove": ["254", "443"]
	},
	"steps": [{
		"id": "731",
		"status": "TODO",
		"comment": "the comment 1"
	}, {
		"id": "730",
		"status": "PASS",
		"defects": {
			"add": [
				"test-114",
				"test-115",
				"test-116",
				"appId=a364a9c7-9ac0-3183-9175-353c1331692a&issue=SDP-5"
			]
		},
		"evidences": {
			"add": [{
				"filename": "test1.txt",
				"contentType": "plain/text",
				"data": "(base64 encoding...)"
			}, {
				"filename": "test2.txt",
				"contentType": "plain/text",
				"data": "(base64 encoding...)"
			}],
			"remove": ["274", "543"]
		}
	}]
}
Example Input 3
{
    "status": "FAIL",
    "defects": {"add":["appId=a364a9c7-9ac0-3183-9175-353c1331692a&issue=SDP-5"], "remove":["DCW-9", "appId=a364a9c7-9ac0-3183-9175-353c1331692a&issue=SDP-1"]},
    "evidences": [],
    "steps": [
        {
            "id": 43,
            "status": "PASS",
            "comment": "",
            "defects": {"add":[], "remove":["DCW-9"]},
            "evidences": []
        },
        {
            "id": 44,
            "status": "FAIL",
            "defects": {},
            "evidences": []
        },
        {
            "id": 45,
            "status": "FAIL",
            "defects": {},
            "evidences": []
        }
    ]
}

Example Request

curl -H "Content-Type: application/json" -X PUT -u admin:admin --data @example.json http://yourserver / rest/raven/1.0/api/testrun/1


Responses

200 OK : text/plain : Successful.  

400 BAD_REQUEST : text/plain : Returns the error.

401 UNAUTHORIZED : text/plain : The Xray license is not valid.

500  INTERNAL SERVER ERROR : text/plain : An internal error occurred updating the test run.

Status

  • To view the status of a Test Run, you need to specify the ID of the Test Run.
  • To update the status, an additional parameter is required: the Status that you want the Test Run to have.


Return a json that contains the test run status.

Request

PATH PARAMETERS
parametertypedescription
idinteger

- ID of the test run.

Example Request

curl -H "Content-Type: application/json" -X GET -u admin:admin http://yourserver/rest/raven/1.0/api/testrun/3/status

Responses

200 OK : text/plain : Successful. Returns the name of the test run Status. 

Example Output
PASS

400 BAD_REQUEST : text/plain : Returns the error.

401 UNAUTHORIZED : text/plain : The Xray license is not valid.

500  INTERNAL SERVER ERROR : text/plain : An internal error occurred when getting the test run status.

  • No labels