---
title: "Test Examples - REST"
canonical: "https://docs.getxray.app/space/XRAY/301506796/Test%20Examples%20-%20REST"
format: markdown
---
## Test Examples

- To view a specific Test Example from a (Cucumber Scenario Outline) Test Run, you need to specify the ID of the Test Run and the index of the test example (from 0 to number of test examples minus 1).
- To update the status, an additional parameter is required: the Status that you want the Test Example to have.


> Macro (rw-ui-expands-macro)
> 
> > Macro (rw-expand)
> 
> Return a json that represents the test run.
> 
> ### ** **<span style="color: #003366">**Request**</span>** **
> 
> ###### ** **<span style="color: #003366">**PATH PARAMETERS**</span>
> 
> | **parameter** | **type** | **description** |
> | --- | --- | --- |
> | `id` | *Integer* | - id of the test run. |
> | exampleIndex | *Integer* | - index of the example. |
> 
> ### <span style="color: #003366">**Responses**</span>** **
> 
> 200 OK : **text/plain** : Successful. Returns a json with the test run example.
> 
> ##### **Example Output**
> 
> ```
> {
>   "id": 5068,
>   "rank": 1,
>   "values": [
>     "0",
>     "factorial",
>     "1"
>   ],
>   "status": "PASS",
>   "statusDescription": "The test run has passed",
>   "duration": "0 millisec",
>   "backgrounds": [
>     {
>       "id": 1337,
>       "rank": 1,
>       "type": "background",
>       "keyword": "Given ",
>       "name": "a calculator I just turned on",
>       "duration": "0 millisec",
>       "status": "PASS"
>     }
>   ],
>   "hooks": [
>     {
>       "id": 1338,
>       "rank": 2,
>       "type": "hook",
>       "keyword": "Before",
>       "name": "FactorialCalculator.setUp()",
>       "duration": "0 millisec",
>       "status": "PASS"
>     },
>     {
>       "id": 1339,
>       "rank": 3,
>       "type": "hook",
>       "keyword": "After",
>       "name": "FactorialCalculator.tearDown()",
>       "duration": "0 millisec",
>       "status": "PASS"
>     }
>   ],
>   "steps": [
>     {
>       "id": 1340,
>       "rank": 4,
>       "type": "scenario",
>       "keyword": "Given ",
>       "name": "I have entered 3 into the calculator",
>       "duration": "0 millisec",
>       "status": "PASS"
>     },
>     {
>       "id": 1341,
>       "rank": 5,
>       "type": "scenario",
>       "keyword": "When ",
>       "name": "I press factorial",
>       "duration": "0 millisec",
>       "status": "PASS"
>     },
>     {
>       "id": 1342,
>       "rank": 6,
>       "type": "scenario",
>       "keyword": "Then ",
>       "name": "the result should be 6 on the screen",
>       "duration": "0 millisec",
>       "status": "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 getting the test run example.
> 
> > ℹ️ The Cucumber Scenarios Example/Result details (i.e., **Hooks, Backgrounds **and** Steps**) are only available for executions done in Xray v2.2.0 and above.


> Macro (rw-ui-expands-macro)
> 
> > Macro (rw-expand)
> 
> Update the test run example status.
> 
> ### ** **<span style="color: #003366">**Request**</span>** **
> 
> ###### ** **<span style="color: #003366">**PATH PARAMETERS**</span>
> 
> | **parameter** | **type** | **description** |
> | --- | --- | --- |
> | `id` | *Integer* | - ID of the test run. |
> | exampleIndex | *Integer* | - index of the example. |
> 
> ###### <span style="color: #003366">**QUERY PARAMETERS**</span>
> 
> | **parameter** | **type** | **description** |
> | --- | --- | --- |
> | status | *String* | - The status you want the test run to have. |
> 
> ### <span style="color: #003366">**Responses**</span>** **
> 
> 200 OK  :  **text/plain**  : Successful.
> 
> 400 BAD_REQUEST : **text/plain** : Returns the error.
> 
> 401 UNAUTHORIZED : **text/plain** : The Xray is not valid.
> 
> 500  INTERNAL SERVER ERROR : **text/plain** : An internal error occurred updating the test run example status.