Page History
...
Expand | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||||||||||||||
|
Behave JSON results
After executing Behave features, you must import the outputted JSON execution results to Jira using the following endpoint:
...
title | POST /api/v2/import/execution/behave |
---|
...
borderColor | #ccc |
---|---|
borderStyle | solid |
Import the execution results created with the Behave JSON output formatter.
Request
Example
Code Block | ||
---|---|---|
| ||
[
{
"elements": [
{
"keyword": "Background",
"location": "features/tutorial09_background.feature:3",
"name": "Ninja fight setup",
"steps": [
{
"keyword": "Given",
"location": "features/tutorial09_background.feature:4",
"name": "the ninja encounters another opponent",
"step_type": "given"
}
],
"type": "background"
},
{
"keyword": "Scenario",
"location": "features/tutorial09_background.feature:7",
"name": "Weaker opponent",
"status": "passed",
"steps": [
{
"keyword": "Given",
"location": "features/tutorial09_background.feature:4",
"match": {
"arguments": [],
"location": "features/steps/step_tutorial02.py:78"
},
"name": "the ninja encounters another opponent",
"result": {
"duration": 0.0007519721984863281,
"status": "passed"
},
"step_type": "given"
},
{
"keyword": "Given",
"location": "features/tutorial09_background.feature:8",
"match": {
"arguments": [
{
"name": "achievement_level",
"value": "third level black-belt"
}
],
"location": "features/steps/step_tutorial02.py:57"
},
"name": "the ninja has a third level black-belt",
"result": {
"duration": 8.988380432128906e-05,
"status": "passed"
},
"step_type": "given"
},
{
"keyword": "When",
"location": "features/tutorial09_background.feature:9",
"match": {
"arguments": [
{
"name": "opponent_role",
"value": "samurai"
}
],
"location": "features/steps/step_tutorial02.py:61"
},
"name": "attacked by a samurai",
"result": {
"duration": 6.29425048828125e-05,
"status": "passed"
},
"step_type": "when"
},
{
"keyword": "Then",
"location": "features/tutorial09_background.feature:10",
"match": {
"arguments": [
{
"name": "reaction",
"value": "engage the opponent"
}
],
"location": "features/steps/step_tutorial02.py:69"
},
"name": "the ninja should engage the opponent",
"result": {
"duration": 7.295608520507812e-05,
"status": "passed"
},
"step_type": "then"
}
],
"tags": [
"TEST_DEMO-3",
"TESTSET_DEMO-6",
"REQ_DEMO-7"
],
"type": "scenario"
},
{
"keyword": "Scenario",
"location": "features/tutorial09_background.feature:13",
"name": "Stronger opponent",
"status": "passed",
"steps": [
{
"keyword": "Given",
"location": "features/tutorial09_background.feature:4",
"match": {
"arguments": [],
"location": "features/steps/step_tutorial02.py:78"
},
"name": "the ninja encounters another opponent",
"result": {
"duration": 8.487701416015625e-05,
"status": "passed"
},
"step_type": "given"
},
{
"keyword": "Given",
"location": "features/tutorial09_background.feature:14",
"match": {
"arguments": [
{
"name": "achievement_level",
"value": "second level black-belt"
}
],
"location": "features/steps/step_tutorial02.py:57"
},
"name": "the ninja has a second level black-belt",
"result": {
"duration": 8.130073547363281e-05,
"status": "passed"
},
"step_type": "given"
},
{
"keyword": "When",
"location": "features/tutorial09_background.feature:15",
"match": {
"arguments": [
{
"name": "opponent",
"value": "Chuck Norris"
}
],
"location": "features/steps/step_tutorial02.py:65"
},
"name": "attacked by Chuck Norris",
"result": {
"duration": 6.127357482910156e-05,
"status": "passed"
},
"step_type": "when"
},
{
"keyword": "Then",
"location": "features/tutorial09_background.feature:16",
"match": {
"arguments": [
{
"name": "reaction",
"value": "run for his life"
}
],
"location": "features/steps/step_tutorial02.py:69"
},
"name": "the ninja should run for his life",
"result": {
"duration": 8.821487426757812e-05,
"status": "passed"
},
"step_type": "then"
}
],
"tags": [
"TEST_DEMO-4",
"TESTSET_DEMO-6",
"REQ_DEMO-7"
],
"type": "scenario"
}
],
"keyword": "Feature",
"location": "features/tutorial09_background.feature:1",
"name": "Using Background -- Fight or Flight",
"status": "passed",
"tags": []
}
] |
Tip | ||
---|---|---|
| ||
curl -H "Content-Type: application/json" -X POST -H "Authorization: Bearer $token" --data @"data.json" https://xray.cloud.getxray.app/api/v2/import/execution/behave |
Responses
200 OK : application/json : Successful. The results were successfully imported to Jira.
Code Block | ||
---|---|---|
| ||
{
"id": "10200",
"key": "XNP-24",
"self": "https://www.example.com/rest/api/2/issue/10200"
} |
400 BAD_REQUEST : application/json : No execution results were provided.
401 UNAUTHORIZED : application/json : The Xray license is not valid.
500 INTERNAL SERVER ERROR : application/json : An internal error occurred when importing execution results.
Behave JSON results Multipart
Xray provides another endpoint if you want to create new Test Executions and have control over newly-created Test Execution fields. It allows you to send two JSON files, the normal Behave result JSON and a JSON similar to the one Jira uses to create new issues. For more information about that second format, check the Jira documentation here.
...
title | POST /api/v2/import/execution/behave/multipart |
---|
...
borderColor | #ccc |
---|---|
borderStyle | solid |
Import the execution results created with the Behave JSON output formatter.
Request
Example
Code Block | ||
---|---|---|
| ||
[
{
"elements": [
{
"keyword": "Background",
"location": "features/tutorial09_background.feature:3",
"name": "Ninja fight setup",
"steps": [
{
"keyword": "Given",
"location": "features/tutorial09_background.feature:4",
"name": "the ninja encounters another opponent",
"step_type": "given"
}
],
"type": "background"
},
{
"keyword": "Scenario",
"location": "features/tutorial09_background.feature:7",
"name": "Weaker opponent",
"status": "passed",
"steps": [
{
"keyword": "Given",
"location": "features/tutorial09_background.feature:4",
"match": {
"arguments": [],
"location": "features/steps/step_tutorial02.py:78"
},
"name": "the ninja encounters another opponent",
"result": {
"duration": 0.0007519721984863281,
"status": "passed"
},
"step_type": "given"
},
{
"keyword": "Given",
"location": "features/tutorial09_background.feature:8",
"match": {
"arguments": [
{
"name": "achievement_level",
"value": "third level black-belt"
}
],
"location": "features/steps/step_tutorial02.py:57"
},
"name": "the ninja has a third level black-belt",
"result": {
"duration": 8.988380432128906e-05,
"status": "passed"
},
"step_type": "given"
},
{
"keyword": "When",
"location": "features/tutorial09_background.feature:9",
"match": {
"arguments": [
{
"name": "opponent_role",
"value": "samurai"
}
],
"location": "features/steps/step_tutorial02.py:61"
},
"name": "attacked by a samurai",
"result": {
"duration": 6.29425048828125e-05,
"status": "passed"
},
"step_type": "when"
},
{
"keyword": "Then",
"location": "features/tutorial09_background.feature:10",
"match": {
"arguments": [
{
"name": "reaction",
"value": "engage the opponent"
}
],
"location": "features/steps/step_tutorial02.py:69"
},
"name": "the ninja should engage the opponent",
"result": {
"duration": 7.295608520507812e-05,
"status": "passed"
},
"step_type": "then"
}
],
"tags": [
"TEST_DEMO-3",
"TESTSET_DEMO-6",
"REQ_DEMO-7"
],
"type": "scenario"
},
{
"keyword": "Scenario",
"location": "features/tutorial09_background.feature:13",
"name": "Stronger opponent",
"status": "passed",
"steps": [
{
"keyword": "Given",
"location": "features/tutorial09_background.feature:4",
"match": {
"arguments": [],
"location": "features/steps/step_tutorial02.py:78"
},
"name": "the ninja encounters another opponent",
"result": {
"duration": 8.487701416015625e-05,
"status": "passed"
},
"step_type": "given"
},
{
"keyword": "Given",
"location": "features/tutorial09_background.feature:14",
"match": {
"arguments": [
{
"name": "achievement_level",
"value": "second level black-belt"
}
],
"location": "features/steps/step_tutorial02.py:57"
},
"name": "the ninja has a second level black-belt",
"result": {
"duration": 8.130073547363281e-05,
"status": "passed"
},
"step_type": "given"
},
{
"keyword": "When",
"location": "features/tutorial09_background.feature:15",
"match": {
"arguments": [
{
"name": "opponent",
"value": "Chuck Norris"
}
],
"location": "features/steps/step_tutorial02.py:65"
},
"name": "attacked by Chuck Norris",
"result": {
"duration": 6.127357482910156e-05,
"status": "passed"
},
"step_type": "when"
},
{
"keyword": "Then",
"location": "features/tutorial09_background.feature:16",
"match": {
"arguments": [
{
"name": "reaction",
"value": "run for his life"
}
],
"location": "features/steps/step_tutorial02.py:69"
},
"name": "the ninja should run for his life",
"result": {
"duration": 8.821487426757812e-05,
"status": "passed"
},
"step_type": "then"
}
],
"tags": [
"TEST_DEMO-4",
"TESTSET_DEMO-6",
"REQ_DEMO-7"
],
"type": "scenario"
}
],
"keyword": "Feature",
"location": "features/tutorial09_background.feature:1",
"name": "Using Background -- Fight or Flight",
"status": "passed",
"tags": []
}
] |
Code Block | ||
---|---|---|
| ||
{
"fields": {
"project": {
"key": "DEMO"
},
"summary": "Brand new Test execution (behave multipart)",
"issuetype": {
"id": "10008"
}
},
"xrayFields": {
"testPlanKey": "DEMO-9"
}
} |
Tip | ||
---|---|---|
| ||
curl -H "Content-Type: multipart/form-data" -X POST -F info=@issueFields.json -F results=@results.json -H "Authorization: Bearer $token" https://xray.cloud.getxray.app/api/v2/import/execution/behave/multipart |
Responses
200 OK : application/json : Successful. The results were successfully imported to Jira.
Code Block | ||
---|---|---|
| ||
{
"id": "10200",
"key": "DEMO-24",
"self": "https://www.example.com/rest/api/2/issue/10200"
} |
400 BAD_REQUEST : application/json : No execution results were provided.
401 UNAUTHORIZED : application/json : The Xray license is not valid.
500 INTERNAL SERVER ERROR : application/json : An internal error occurred when importing execution results.