Test Cases
This chapter focuses on services for the test cases.
Get all test cases
A GET
to /test-cases
returns all the test-cases that the client is allowed to read.
HTTP request
GET /api/rest/latest/test-cases?page=1&size=2 HTTP/1.1
Accept: application/json
Host: localhost:8080
Request parameters
Parameter | Description |
---|---|
|
number of the page to retrieve (optional) |
|
size of the page to retrieve (optional) |
|
which attributes of the returned entities should be sorted on (optional) |
|
which fields of the elements should be returned (optional) |
HTTP response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 1232
{
"_embedded" : {
"test-cases" : [ {
"_type" : "test-case",
"id" : 1,
"name" : "sample standard test case",
"reference" : "TC1",
"kind" : "STANDARD",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/1"
}
}
}, {
"_type" : "test-case",
"id" : 2,
"name" : "sample script test case",
"reference" : "TC2",
"kind" : "GHERKIN",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/2"
}
}
} ]
},
"_links" : {
"first" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases?page=0&size=2"
},
"prev" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases?page=0&size=2"
},
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases?page=1&size=2"
},
"next" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases?page=2&size=2"
},
"last" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases?page=2&size=2"
}
},
"page" : {
"size" : 2,
"totalElements" : 5,
"totalPages" : 3,
"number" : 1
}
}
Response fields
Path | Type | Description |
---|---|---|
|
|
the list of elements for that page |
|
|
the page size for that query |
|
|
total number of elements the client is allowed to read |
|
|
how many pages can be browsed |
|
|
the page number |
|
|
related links |
Links
Relation | Description |
---|---|
|
link to the first page (optional) |
|
link to the previous page (optional) |
|
link to this page |
|
link to the next page (optional) |
|
link to the last page (optional) |
Create test case
A POST
to /test-cases
creates a new test case.
HTTP request
POST /api/rest/latest/test-cases HTTP/1.1
Content-Type: application/json
Accept: application/json
Host: localhost:8080
Content-Length: 129
{
"_type" : "test-case",
"name" : "Christmas turkey test flight",
"parent" : {
"_type" : "project",
"id" : 15
}
}
HTTP response
HTTP/1.1 201 Created
Content-Type: application/json;charset=UTF-8
Content-Length: 1782
{
"_type" : "test-case",
"id" : 240,
"name" : "Christmas turkey test flight",
"reference" : "",
"kind" : "STANDARD",
"project" : {
"_type" : "project",
"id" : 15,
"name" : "Christmas Eve",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/projects/15"
}
}
},
"path" : "/Christmas Eve/Christmas turkey test flight",
"parent" : {
"_type" : "project",
"id" : 15,
"name" : "Christmas Eve",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/projects/15"
}
}
},
"created_by" : "admin",
"created_on" : "2017-06-15T10:00:00.000+0000",
"last_modified_by" : "admin",
"last_modified_on" : "2017-06-15T10:00:00.000+0000",
"importance" : "LOW",
"status" : "WORK_IN_PROGRESS",
"nature" : {
"code" : "NAT_FUNCTIONAL_TESTING"
},
"type" : {
"code" : "TYP_EVOLUTION_TESTING"
},
"prerequisite" : "",
"description" : null,
"custom_fields" : [ ],
"steps" : [ ],
"parameters" : [ ],
"datasets" : [ ],
"language" : "",
"script" : "",
"verified_requirements" : [ ],
"attachments" : [ ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/240"
},
"project" : {
"href" : "http://localhost:8080/api/rest/latest/projects/15"
},
"steps" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/240/steps"
},
"parameters" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/240/parameters"
},
"datasets" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/240/datasets"
},
"attachments" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/240/attachments"
}
}
}
Get test case
A GET
to /test-cases/{id}
returns the test case with the given id.
Path parameters
Parameter | Description |
---|---|
|
the id of the test case |
HTTP request
GET /api/rest/latest/test-cases/238 HTTP/1.1
Accept: application/json
Host: localhost:8080
Request parameters
Parameter | Description |
---|---|
|
which fields of the elements should be returned (optional) |
HTTP response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 5462
{
"_type" : "test-case",
"id" : 238,
"name" : "walking test",
"reference" : "TC1",
"kind" : "STANDARD",
"project" : {
"_type" : "project",
"id" : 14,
"name" : "sample project",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/projects/14"
}
}
},
"path" : "/sample project/sample folder/walking test",
"parent" : {
"_type" : "test-case-folder",
"id" : 237,
"name" : "sample folder",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-case-folders/237"
}
}
},
"created_by" : "User-1",
"created_on" : "2017-06-15T10:00:00.000+0000",
"last_modified_by" : "User-1",
"last_modified_on" : "2017-06-15T10:00:00.000+0000",
"importance" : "LOW",
"status" : "WORK_IN_PROGRESS",
"nature" : {
"code" : "NAT_USER_TESTING"
},
"type" : {
"code" : "TYP_EVOLUTION_TESTING"
},
"prerequisite" : "<p>You must have legs with feet attached to them (one per leg)</p>\n",
"description" : "<p>check that you can walk through the API (literally)</p>\n",
"custom_fields" : [ {
"code" : "CF_TXT",
"label" : "test level",
"value" : "mandatory"
}, {
"code" : "CF_TAGS",
"label" : "see also",
"value" : [ "walking", "bipedal" ]
} ],
"steps" : [ {
"_type" : "action-step",
"id" : 165,
"action" : "<p>move ${first_foot} forward</p>\n",
"expected_result" : "<p>I just advanced by one step</p>\n",
"index" : 0,
"custom_fields" : [ {
"code" : "CF_TXT",
"label" : "test level",
"value" : "mandatory"
}, {
"code" : "CF_TAGS",
"label" : "see also",
"value" : [ "basic", "walking" ]
} ],
"attachments" : [ ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-steps/165"
}
}
}, {
"_type" : "action-step",
"id" : 166,
"action" : "<p>move ${second_foot} forward</p>\n",
"expected_result" : "<p>and another step !</p>\n",
"index" : 1,
"custom_fields" : [ {
"code" : "CF_TXT",
"label" : "test level",
"value" : "mandatory"
}, {
"code" : "CF_TAGS",
"label" : "see also",
"value" : [ "basic", "walking" ]
} ],
"attachments" : [ ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-steps/166"
}
}
}, {
"_type" : "call-step",
"id" : 167,
"delegate_parameter_values" : false,
"called_test_case" : {
"_type" : "test-case",
"id" : 239,
"name" : "victory dance",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/239"
}
}
},
"called_dataset" : null,
"index" : 2,
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-steps/167"
}
}
}, {
"_type" : "call-step",
"id" : 168,
"delegate_parameter_values" : false,
"called_test_case" : {
"_type" : "unauthorized-resource",
"resource_type" : "test-case",
"resource_id" : 240,
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/240"
}
}
},
"called_dataset" : null,
"index" : 3,
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-steps/168"
}
}
} ],
"parameters" : [ {
"_type" : "parameter",
"id" : 1,
"name" : "first_foot",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/parameters/1"
}
}
}, {
"_type" : "parameter",
"id" : 2,
"name" : "second_foot",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/parameters/2"
}
}
} ],
"datasets" : [ {
"_type" : "dataset",
"id" : 1,
"name" : "right handed people",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/datasets/1"
}
}
}, {
"_type" : "dataset",
"id" : 2,
"name" : "left handed people",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/datasets/2"
}
}
} ],
"language" : "",
"script" : "",
"verified_requirements" : [ {
"_type" : "requirement-version",
"id" : 255,
"name" : "Must have legs",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/requirement-versions/255"
}
}
}, {
"_type" : "unauthorized-resource",
"resource_type" : "requirement-version",
"resource_id" : 256,
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/requirement-versions/256"
}
}
} ],
"attachments" : [ ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/238"
},
"project" : {
"href" : "http://localhost:8080/api/rest/latest/projects/14"
},
"steps" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/238/steps"
},
"parameters" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/238/parameters"
},
"datasets" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/238/datasets"
},
"attachments" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/238/attachments"
}
}
}
Response fields
Path | Type | Description |
---|---|---|
|
|
the id of the entity |
|
|
the type of the entity |
|
|
name of the test case |
|
|
kind of the test case: standard or Gherkin |
|
|
project of the test case |
|
|
the location of the test case (either a folder or the project if located at the root of the library) |
|
|
the path of the test case |
|
|
user that created the test case |
|
|
timestamp of the creation (ISO 8601) |
|
|
user that modified the test case the most recently |
|
|
timestamp of last modification (ISO 8601) |
|
|
a shorter identifier for that test case |
|
|
code of the importance |
|
|
code of the status |
|
|
code of the nature |
|
|
code of the type of test case |
|
|
description of the test case (html) |
|
|
prerequisites that should be met before the execution of the test script (html) |
|
|
array of custom fields |
|
|
code of the custom field |
|
|
label 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 step list that constitute the script. Please refer to the test steps documentation. |
|
|
the list of parameters. Please refer to the parameters documentation. |
|
|
the list of datasets. Please refer to the datasets documentation. |
|
|
the language used for script test case. |
|
|
the script of Gherkin test case. |
|
|
the list of verified requirements. Please refer to the requirements documentation. |
|
|
the list of attachments. |
|
|
related links |
Links
Relation | Description |
---|---|
|
link to this test case |
|
link to its project |
|
link to the test script |
|
link to the parameters |
|
link to the datasets |
|
link to the attachments |
Modify test case
A PATCH
to /test-cases/{id}
modifies the test case with the given id.
HTTP request
PATCH /api/rest/latest/test-cases/240 HTTP/1.1
Content-Type: application/json
Accept: application/json
Host: localhost:8080
Content-Length: 70
{
"_type" : "test-case",
"name" : "Christmas turkey test launch"
}
HTTP response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 1782
{
"_type" : "test-case",
"id" : 240,
"name" : "Christmas turkey test launch",
"reference" : "",
"kind" : "STANDARD",
"project" : {
"_type" : "project",
"id" : 15,
"name" : "Christmas Eve",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/projects/15"
}
}
},
"path" : "/Christmas Eve/Christmas turkey test launch",
"parent" : {
"_type" : "project",
"id" : 15,
"name" : "Christmas Eve",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/projects/15"
}
}
},
"created_by" : "admin",
"created_on" : "2017-06-15T10:00:00.000+0000",
"last_modified_by" : "admin",
"last_modified_on" : "2017-06-15T10:00:00.000+0000",
"importance" : "LOW",
"status" : "WORK_IN_PROGRESS",
"nature" : {
"code" : "NAT_FUNCTIONAL_TESTING"
},
"type" : {
"code" : "TYP_EVOLUTION_TESTING"
},
"prerequisite" : "",
"description" : null,
"custom_fields" : [ ],
"steps" : [ ],
"parameters" : [ ],
"datasets" : [ ],
"language" : "",
"script" : "",
"verified_requirements" : [ ],
"attachments" : [ ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/240"
},
"project" : {
"href" : "http://localhost:8080/api/rest/latest/projects/15"
},
"steps" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/240/steps"
},
"parameters" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/240/parameters"
},
"datasets" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/240/datasets"
},
"attachments" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/240/attachments"
}
}
}
Get datasets of test case
A GET
to /test-cases/{id}/datasets
returns all the datasets of the test case with the given id.
Path parameters
Parameter | Description |
---|---|
|
the id of the test case |
HTTP request
GET /api/rest/latest/test-cases/238/datasets HTTP/1.1
Accept: application/json
Host: localhost:8080
Request parameters
Parameter | Description |
---|---|
|
number of the page to retrieve (optional) |
|
size of the page to retrieve (optional) |
|
which fields of the elements should be returned (optional) |
HTTP response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 1804
{
"_embedded" : {
"datasets" : [ {
"_type" : "dataset",
"id" : 1,
"name" : "big_cake",
"parameters" : [ {
"_type" : "parameter",
"id" : 1,
"name" : "cocoa_purity"
}, {
"_type" : "parameter",
"id" : 2,
"name" : "number_of_layers"
} ],
"parameter_values" : [ {
"parameter_test_case_id" : 238,
"parameter_value" : "98%",
"parameter_name" : "cocoa_purity",
"parameter_id" : 1
}, {
"parameter_test_case_id" : 238,
"parameter_value" : "4",
"parameter_name" : "number_of_layers",
"parameter_id" : 2
} ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/datasets/1"
}
}
}, {
"_type" : "dataset",
"id" : 2,
"name" : "biscuit",
"parameters" : [ {
"_type" : "parameter",
"id" : 1,
"name" : "cocoa_purity"
}, {
"_type" : "parameter",
"id" : 2,
"name" : "number_of_layers"
} ],
"parameter_values" : [ {
"parameter_test_case_id" : 238,
"parameter_value" : "80%",
"parameter_name" : "cocoa_purity",
"parameter_id" : 1
}, {
"parameter_test_case_id" : 238,
"parameter_value" : "1",
"parameter_name" : "number_of_layers",
"parameter_id" : 2
} ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/datasets/2"
}
}
} ]
},
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/238/datasets?page=0&size=20"
}
},
"page" : {
"size" : 20,
"totalElements" : 2,
"totalPages" : 1,
"number" : 0
}
}
Response fields
Path | Type | Description |
---|---|---|
|
|
the datasets of this test case |
|
|
the page size for that query |
|
|
total number of elements the client is allowed to read |
|
|
how many pages can be browsed |
|
|
the page number |
|
|
related links |
Links
Relation | Description |
---|---|
|
link to the first page (optional) |
|
link to the previous page (optional) |
|
link to this page |
|
link to the next page (optional) |
|
link to the last page (optional) |
Get parameters of test case
A GET
to /test-cases/{id}/parameters
returns all the parameters of the test case with the given id.
Path parameters
Parameter | Description |
---|---|
|
the id of the test case |
HTTP request
GET /api/rest/latest/test-cases/238/parameters HTTP/1.1
Accept: application/json
Host: localhost:8080
Request parameters
Parameter | Description |
---|---|
|
number of the page to retrieve (optional) |
|
size of the page to retrieve (optional) |
|
which fields of the elements should be returned (optional) |
HTTP response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 1380
{
"_embedded" : {
"parameters" : [ {
"_type" : "parameter",
"id" : 1,
"name" : "cocoa_purity",
"description" : "<p>how refined the cocoa cream should be</p>",
"test_case" : {
"_type" : "test-case",
"id" : 238,
"name" : "Chocolate cake",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/238"
}
}
},
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/parameters/1"
}
}
}, {
"_type" : "parameter",
"id" : 2,
"name" : "number_of_layers",
"description" : "<p>how many times should the base pattern be repeated</p>",
"test_case" : {
"_type" : "test-case",
"id" : 238,
"name" : "Chocolate cake",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/238"
}
}
},
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/parameters/2"
}
}
} ]
},
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/238/parameters?page=0&size=20"
}
},
"page" : {
"size" : 20,
"totalElements" : 2,
"totalPages" : 1,
"number" : 0
}
}
Response fields
Path | Type | Description |
---|---|---|
|
|
the parameters of this test case |
|
|
the page size for that query |
|
|
total number of elements the client is allowed to read |
|
|
how many pages can be browsed |
|
|
the page number |
|
|
related links |
Links
Relation | Description |
---|---|
|
link to the first page (optional) |
|
link to the previous page (optional) |
|
link to this page |
|
link to the next page (optional) |
|
link to the last page (optional) |
Get steps of test case
A GET
to /test-cases/{id}/test-steps
returns all the steps of the test case with the given id.
Path parameters
Parameter | Description |
---|---|
|
the id of the test case |
HTTP request
GET /api/rest/latest/test-cases/239/steps HTTP/1.1
Accept: application/json
Host: localhost:8080
Request parameters
Parameter | Description |
---|---|
|
number of the page to retrieve (optional) |
|
size of the page to retrieve (optional) |
|
which fields of the elements should be returned (optional) |
HTTP response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 2399
{
"_embedded" : {
"steps" : [ {
"_type" : "action-step",
"id" : 167,
"action" : "<p>Quick step forward</p>\n",
"expected_result" : "<p>So does your opponent</p>\n",
"index" : 0,
"custom_fields" : [ {
"code" : "CHK_BODY_FEINT",
"label" : "requires body feint",
"value" : "false"
} ],
"attachments" : [ ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-steps/167"
}
}
}, {
"_type" : "action-step",
"id" : 168,
"action" : "<p>Another quick step forward, albeit smaller</p>\n",
"expected_result" : "<p>Opponent doubles his steps too then lunges forward for an attack</p>\n",
"index" : 1,
"custom_fields" : [ {
"code" : "CHK_BODY_FEINT",
"label" : "requires body feint",
"value" : "true"
} ],
"attachments" : [ ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-steps/168"
}
}
}, {
"_type" : "action-step",
"id" : 169,
"action" : "<p>Strong Quarte parry, possibly with a slight retreat.</p>\n",
"expected_result" : "<p>Opponent's attack gets blocked by your blade.</p>\n",
"index" : 2,
"custom_fields" : [ {
"code" : "CHK_BODY_FEINT",
"label" : "requires body feint",
"value" : "false"
} ],
"attachments" : [ ],
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-steps/169"
}
}
}, {
"_type" : "call-step",
"id" : 170,
"delegate_parameter_values" : true,
"called_test_case" : {
"_type" : "test-case",
"id" : 240,
"name" : "Compound riposte",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/240"
}
}
},
"called_dataset" : null,
"index" : 3,
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-steps/170"
}
}
} ]
},
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/test-cases/239/steps?page=0&size=20"
}
},
"page" : {
"size" : 20,
"totalElements" : 4,
"totalPages" : 1,
"number" : 0
}
}
Response fields
Path | Type | Description |
---|---|---|
|
|
the steps of this test case |
|
|
the page size for that query |
|
|
total number of elements the client is allowed to read |
|
|
how many pages can be browsed |
|
|
the page number |
|
|
related links |
Links
Relation | Description |
---|---|
|
link to the first page (optional) |
|
link to the previous page (optional) |
|
link to this page |
|
link to the next page (optional) |
|
link to the last page (optional) |