Test Steps
This chapter focuses on services for the test steps.
Get test step
A GET
to /test-steps/{id}
returns the test step with the given id, this step can be either an action step, a call step, or a keyword step.
Path parameters
Parameter | Description |
---|---|
|
the id of the step (optional) |
HTTP request
GET /api/rest/latest/test-steps/235 HTTP/1.1
Accept: application/json
Host: localhost:8080
Request parameters
Parameter | Description |
---|---|
|
which fields of the elements should be returned (optional) |
-
In case of an action step :
HTTP response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 798
{
"_type" : "action-step",
"id" : 235,
"test_case" : {
"_type" : "test-case",
"id" : 120,
"name" : "Door opening system",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/120"
}
}
},
"action" : "<p>Wave your hand</p>",
"expected_result" : "<p>The door opens</p>",
"index" : 0,
"custom_fields" : [ {
"code" : "cuf_txt_note",
"label" : "note",
"value" : "Star Trek style welcomed but not mandatory"
}, {
"code" : "cuf_tags_see_also",
"label" : "see also",
"value" : [ "smart home", "sensors", "hand gesture" ]
} ],
"verified_requirements" : [ ],
"attachments" : [ ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-steps/235"
}
}
}
Response fields
Path | Type | Description |
---|---|---|
|
|
the id of the step |
|
|
the type of step |
|
|
the action to be accomplished, format is html |
|
|
the state or behavior that should be observable when the action has been performed, format is html) |
|
|
the test case this step is part of |
|
|
the index of current step in the test case |
|
|
the custom fields of that test step |
|
|
the label of the custom field |
|
|
the code of the custom field |
|
|
the value of the custom field. The value is either a string (for most custom fields), or an array of strings (for multivalued custom fields eg a tag list) |
|
|
the attachments of that test step |
|
|
the list of verified requirements. Please refer to the requirements documentation. |
|
|
related links |
Links
Relation | Description |
---|---|
|
link to this step |
-
In case of a call step :
HTTP response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 854
{
"_type" : "call-step",
"id" : 441,
"test_case" : {
"_type" : "test-case",
"id" : 297,
"name" : "Order a meal",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/297"
}
}
},
"delegate_parameter_values" : false,
"called_test_case" : {
"_type" : "test-case",
"id" : 276,
"name" : "Order a coffee",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/276"
}
}
},
"called_dataset" : {
"_type" : "dataset",
"id" : 33,
"name" : "topping",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/datasets/33"
}
}
},
"index" : 0,
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-steps/441"
}
}
}
Response fields
Path | Type | Description |
---|---|---|
|
|
the id of the step |
|
|
the type of step |
|
|
the test case this step belongs to |
|
|
the index of the step in the test case |
|
|
the test case called by this step |
|
|
the dataset to use for the called test case, if any (may be null if not) |
|
|
whether the parameters of the called test case should be set by the caller rather than by a dataset of the called. A value of 'true' usually mean that the 'called_dataset' is null. |
|
|
related links |
Links
Relation | Description |
---|---|
|
link to this step |
-
In case of a keyword step :
HTTP response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 610
{
"_type" : "keyword-step",
"id" : 442,
"test_case" : {
"_type" : "keyword-test-case",
"id" : 298,
"name" : "Order a meal",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/298"
}
}
},
"keyword" : "GIVEN",
"action" : "a customer named \"Gustave\"",
"datatable" : "| product | price |\n| Expresso | 0.40 |",
"docstring" : "",
"comment" : "Products are from France.\nPrices are all with tax.",
"index" : 0,
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-steps/442"
}
}
}
Response fields
Path | Type | Description |
---|---|---|
|
|
the id of the step |
|
|
the type of step |
|
|
the test case this step belongs to |
|
|
the part which gives structure and meaning to an action word. Possible values are : GIVEN, WHEN, THEN, BUT, AND |
|
|
the action of the step |
|
|
the datatable of the step |
|
|
the docstring of the step |
|
|
the comment of the step |
|
|
the index of the step in the test case |
|
|
related links |
Links
Relation | Description |
---|---|
|
link to this step |
Modify test step
A PATCH
to /test-steps/{id}
modifies the test step with the given id.
Path parameters
Parameter | Description |
---|---|
|
the id of the step |
Request parameters
Parameter | Description |
---|---|
|
which fields of the elements should be returned (optional) |
-
In case of an action step :
HTTP request
PATCH /api/rest/latest/test-steps/210 HTTP/1.1
Content-Type: application/json
Accept: application/json
Content-Length: 314
Host: localhost:8080
{
"_type" : "action-step",
"action" : "<p>hadouken</p>",
"expected_result" : "<p>ko</p>",
"custom_fields" : [ {
"code" : "cuf_txt_note",
"value" : "Star Trek style welcomed but not mandatory"
}, {
"code" : "cuf_tags_see_also",
"value" : [ "smart home", "sensors", "hand gesture" ]
} ]
}
Request fields
Path | Type | Description |
---|---|---|
|
|
the type of step |
|
|
the action to be accomplished, format is html |
|
|
the state or behavior that should be observable when the action has been performed, format is html) |
|
|
the custom fields of that test step |
|
|
the code of the custom field |
|
|
the value of the custom field. The value is either a string (for most custom fields), or an array of strings (for multivalued custom fields eg a tag list) |
HTTP response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 874
{
"_type" : "action-step",
"id" : 210,
"test_case" : {
"_type" : "test-case",
"id" : 240,
"name" : "target test case",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/240"
}
}
},
"action" : "<p>hadouken</p>",
"expected_result" : "<p>ko</p>",
"index" : 0,
"custom_fields" : [ {
"code" : "cuf_txt_note",
"label" : "note",
"value" : "Star Trek style welcomed but not mandatory"
}, {
"code" : "cuf_tags_see_also",
"label" : "see also",
"value" : [ "smart home", "sensors", "hand gesture" ]
} ],
"verified_requirements" : [ ],
"attachments" : [ ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-steps/210"
},
"test-case" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/240"
}
}
}
Response fields
Path | Type | Description |
---|---|---|
|
|
the id of the step |
|
|
the test case this step is part of |
|
|
the index of current step in the test case |
|
|
the label of the custom field |
|
|
related links |
Links
Relation | Description |
---|---|
|
link to this step |
|
link to the test case where this step belongs |
-
In case of a call step :
HTTP request
PATCH /api/rest/latest/test-steps/441 HTTP/1.1
Content-Type: application/json
Accept: application/json
Content-Length: 150
Host: localhost:8080
{
"_type" : "call-step",
"delegate_parameter_values" : "false",
"index" : 0,
"called_dataset" : {
"_type" : "dataset",
"id" : 33
}
}
Request fields
Path | Type | Description |
---|---|---|
|
|
the type of step |
|
|
whether the parameters of the called test case should be set by the caller rather than by a dataset of the called. A value of 'true' usually mean that the 'called_dataset' is null. |
|
|
the index of the step in the test case |
|
|
the dataset to use for the called test case, if any (may be null if not) |
HTTP response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 954
{
"_type" : "call-step",
"id" : 441,
"test_case" : {
"_type" : "test-case",
"id" : 297,
"name" : "target test case",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/297"
}
}
},
"delegate_parameter_values" : false,
"called_test_case" : {
"_type" : "test-case",
"id" : 365,
"name" : "call me later",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/365"
}
}
},
"called_dataset" : {
"_type" : "dataset",
"id" : 33,
"name" : "topping",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/datasets/33"
}
}
},
"index" : 0,
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-steps/441"
},
"test-case" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/297"
}
}
}
Response fields
Path | Type | Description |
---|---|---|
|
|
the id of the step |
|
|
related links |
Links
Relation | Description |
---|---|
|
link to this step |
|
link to the test case where this step belongs |
-
In case of a keyword step :
HTTP request
PATCH /api/rest/latest/test-steps/441 HTTP/1.1
Content-Type: application/json
Accept: application/json
Content-Length: 293
Host: localhost:8080
{
"_type" : "keyword-step",
"index" : 0,
"keyword" : "GIVEN",
"action" : "I am \"happy\"",
"datatable" : "| Product | Price |\n| Espresso | 0.30 |\n| Cappuccino | 0.30 |\n| Macchiato | 0.30 |",
"docstring" : "",
"comment" : "Products are from France.\nPrices are all with tax."
}
Request fields
Path | Type | Description |
---|---|---|
|
|
the type of step |
|
|
the index of the step in the test case |
|
|
the part which gives structure and meaning to an action word. Possible values are : GIVEN, WHEN, THEN, BUT, AND |
|
|
the action of the step |
|
|
the datatable of the step |
|
|
the docstring of the step |
|
|
the comment of the step |
HTTP response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 748
{
"_type" : "keyword-step",
"id" : 441,
"test_case" : {
"_type" : "keyword-test-case",
"id" : 297,
"name" : "target test case",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/297"
}
}
},
"keyword" : "AND",
"action" : "I am \"happy\"",
"datatable" : "| Product | Price |\n| Espresso | 0.30 |\n| Cappuccino | 0.30 |\n| Macchiato | 0.30 |",
"docstring" : "",
"comment" : "Products are from France.\nPrices are all with tax.",
"index" : 0,
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-steps/441"
},
"keyword-test-case" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/297"
}
}
}
Response fields
Path | Type | Description |
---|---|---|
|
|
the id of the step |
|
|
the test case this step is part of |
|
|
related links |
Links
Relation | Description |
---|---|
|
link to this step |
|
link to the test case where this step belongs |
Delete test step
A DELETE
to /test-steps/{ids}
deletes the test steps with the given ids.
Path parameters
Parameter | Description |
---|---|
|
the list of ids of the steps |
HTTP request
DELETE /api/rest/latest/test-steps/169,180 HTTP/1.1
Content-Type: application/json
Accept: application/json
Host: localhost:8080
Create test step
A POST
to /test-cases/{testCaseId}/steps
creates a new test step (action step or call step).
Path parameters
Parameter | Description |
---|---|
|
the id of the test case of which to add new test step |
Request parameters
Parameter | Description |
---|---|
|
which fields of the elements should be returned (optional) |
-
In case of an action step :
HTTP request
POST /api/rest/latest/test-cases/240/steps HTTP/1.1
Content-Type: application/json
Accept: application/json
Content-Length: 331
Host: localhost:8080
{
"_type" : "action-step",
"action" : "<p>simple test step</p>",
"expected_result" : "<p>action step</p>",
"custom_fields" : [ {
"code" : "cuf_txt_note",
"value" : "Star Trek style welcomed but not mandatory"
}, {
"code" : "cuf_tags_see_also",
"value" : [ "smart home", "sensors", "hand gesture" ]
} ]
}
Request fields
Path | Type | Description |
---|---|---|
|
|
the type of step |
|
|
the action to be accomplished, format is html |
|
|
the state or behavior that should be observable when the action has been performed, format is html) |
|
|
the custom fields of that test step |
|
|
the code of the custom field |
|
|
the value of the custom field. The value is either a string (for most custom fields), or an array of strings (for multivalued custom fields eg a tag list) |
HTTP response
HTTP/1.1 201 Created
Content-Type: application/json
Content-Length: 891
{
"_type" : "action-step",
"id" : 210,
"test_case" : {
"_type" : "test-case",
"id" : 240,
"name" : "target test case",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/240"
}
}
},
"action" : "<p>simple test step</p>",
"expected_result" : "<p>action step</p>",
"index" : 0,
"custom_fields" : [ {
"code" : "cuf_txt_note",
"label" : "note",
"value" : "Star Trek style welcomed but not mandatory"
}, {
"code" : "cuf_tags_see_also",
"label" : "see also",
"value" : [ "smart home", "sensors", "hand gesture" ]
} ],
"verified_requirements" : [ ],
"attachments" : [ ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-steps/210"
},
"test-case" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/240"
}
}
}
Response fields
Path | Type | Description |
---|---|---|
|
|
the id of the step |
|
|
the test case this step is part of |
|
|
the index of current step in the test case |
|
|
the label of the custom field |
|
|
related links |
Links
Relation | Description |
---|---|
|
link to this step |
|
link to the test case where this step belongs |
-
In case of a call step :
HTTP request
POST /api/rest/latest/test-cases/297/steps HTTP/1.1
Content-Type: application/json
Accept: application/json
Content-Length: 267
Host: localhost:8080
{
"_type" : "call-step",
"delegate_parameter_values" : false,
"called_test_case" : {
"_type" : "test-case",
"id" : 276,
"name" : "test case been called"
},
"called_dataset" : {
"_type" : "dataset",
"id" : 33,
"name" : "topping"
}
}
Request fields
Path | Type | Description |
---|---|---|
|
|
the type of step |
|
|
whether the parameters of the called test case should be set by the caller rather than by a dataset of the called. A value of 'true' usually mean that the 'called_dataset' is null. |
|
|
the test case called by this step |
|
|
the dataset to use for the called test case, if any (may be null if not) |
HTTP response
HTTP/1.1 201 Created
Content-Type: application/json
Content-Length: 962
{
"_type" : "call-step",
"id" : 441,
"test_case" : {
"_type" : "test-case",
"id" : 297,
"name" : "target test case",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/297"
}
}
},
"delegate_parameter_values" : false,
"called_test_case" : {
"_type" : "test-case",
"id" : 276,
"name" : "test case been called",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/276"
}
}
},
"called_dataset" : {
"_type" : "dataset",
"id" : 33,
"name" : "topping",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/datasets/33"
}
}
},
"index" : 0,
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-steps/441"
},
"test-case" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/297"
}
}
}
Response fields
Path | Type | Description |
---|---|---|
|
|
the id of the step |
|
|
the test case this step belongs to |
|
|
the index of the step in the test case |
|
|
related links |
Links
Relation | Description |
---|---|
|
link to this step |
|
link to the test case where this step belongs |
-
In case of a keyword step :
HTTP request
POST /api/rest/latest/test-cases/241/steps HTTP/1.1
Content-Type: application/json
Accept: application/json
Content-Length: 277
Host: localhost:8080
{
"_type" : "keyword-step",
"keyword" : "AND",
"action" : "I have 5 apples",
"datatable" : "| Product | Price |\n| Espresso | 0.30 |\n| Cappuccino | 0.40 |\n| Macchiato | 0.40 |",
"docstring" : "",
"comment" : "Products are from France.\nPrices are all with tax."
}
Request fields
Path | Type | Description |
---|---|---|
|
|
the type of step |
|
|
the part which gives structure and meaning to an action word. Possible values are : GIVEN, WHEN, THEN, BUT, AND |
|
|
the action of the step |
|
|
the datatable of the step |
|
|
the docstring of the step |
|
|
the comment of the step |
HTTP response
HTTP/1.1 201 Created
Content-Type: application/json
Content-Length: 761
{
"_type" : "keyword-step",
"id" : 210,
"test_case" : {
"_type" : "keyword-test-case",
"id" : 241,
"name" : "target keyword test case",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/241"
}
}
},
"keyword" : "AND",
"action" : "I have \"5\" apples",
"datatable" : "| Product | Price |\n| Espresso | 0.30 |\n| Cappuccino | 0.40 |\n| Macchiato | 0.40 |",
"docstring" : "",
"comment" : "Products are from France.\nPrices are all with tax.",
"index" : 0,
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-steps/210"
},
"keyword-test-case" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/241"
}
}
}
Response fields
Path | Type | Description |
---|---|---|
|
|
the id of the step |
|
|
the keyword test case this keyword step is part of |
|
|
the index of current keyword step in the keyword test case |
|
|
related links |
Links
Relation | Description |
---|---|
|
link to this keyword step |
|
link to the keyword test case where this keyword step belongs |
Link requirements to a test step
A POST
to test-steps/{id}/coverages/{requirementIds}
links the requirements to the test step.
Path parameters
Parameter | Description |
---|---|
|
the id of the test step |
|
the ids of the requirements to link |
HTTP request
POST /api/rest/latest/test-steps/235/coverages/12,13,14 HTTP/1.1
Accept: application/json
Host: localhost:8080
HTTP response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 1473
{
"_type" : "action-step",
"id" : 235,
"test_case" : {
"_type" : "test-case",
"id" : 120,
"name" : "Door opening system",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/120"
}
}
},
"action" : "<p>Wave your hand</p>",
"expected_result" : "<p>The door opens</p>",
"index" : 0,
"custom_fields" : [ {
"code" : "cuf_txt_note",
"label" : "note",
"value" : "Star Trek style welcomed but not mandatory"
}, {
"code" : "cuf_tags_see_also",
"label" : "see also",
"value" : [ "smart home", "sensors", "hand gesture" ]
} ],
"verified_requirements" : [ {
"_type" : "requirement-version",
"id" : 12,
"name" : "My first requirement",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/requirement-versions/12"
}
}
}, {
"_type" : "requirement-version",
"id" : 13,
"name" : "My second requirement",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/requirement-versions/13"
}
}
}, {
"_type" : "requirement-version",
"id" : 14,
"name" : "My third requirement",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/requirement-versions/14"
}
}
} ],
"attachments" : [ ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-steps/235"
}
}
}
Unlink requirements from a test step
A DELETE
to test-steps/{id}/coverages/{requirementIds}
unlinks the requirements from the test step.
Path parameters
Parameter | Description |
---|---|
|
the id of the test step |
|
the ids of the requirements to unlink |
HTTP request
DELETE /api/rest/latest/test-steps/235/coverages/12,14 HTTP/1.1
Accept: application/json
Host: localhost:8080