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

Table 1. /api/rest/latest/test-steps/{id}
Parameter Description

id

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

fields

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

id

Number

the id of the step

_type

String

the type of step

action

String

the action to be accomplished, format is html

expected_result

String

the state or behavior that should be observable when the action has been performed, format is html)

test_case

Object

the test case this step is part of

index

Number

the index of current step in the test case

custom_fields

Array

the custom fields of that test step

custom_fields[].label

String

the label of the custom field

custom_fields[].code

String

the code of the custom field

custom_fields[].value

Varies

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)

attachments

Array

the attachments of that test step

verified_requirements

Array

the list of verified requirements. Please refer to the requirements documentation.

_links

Object

related links

Relation Description

self

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

id

Number

the id of the step

_type

String

the type of step

test_case

Object

the test case this step belongs to

index

Number

the index of the step in the test case

called_test_case

Object

the test case called by this step

called_dataset

Object

the dataset to use for the called test case, if any (may be null if not)

delegate_parameter_values

Boolean

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.

_links

Object

related links

Relation Description

self

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

id

Number

the id of the step

_type

String

the type of step

test_case

Object

the test case this step belongs to

keyword

String

the part which gives structure and meaning to an action word. Possible values are : GIVEN, WHEN, THEN, BUT, AND

action

String

the action of the step

datatable

String

the datatable of the step

docstring

String

the docstring of the step

comment

String

the comment of the step

index

Number

the index of the step in the test case

_links

Object

related links

Relation Description

self

link to this step

Modify test step

A PATCH to /test-steps/{id} modifies the test step with the given id.

Path parameters

Table 1. /api/rest/latest/test-steps/{id}
Parameter Description

id

the id of the step

Request parameters

Parameter Description

fields

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

_type

String

the type of step

action

String

the action to be accomplished, format is html

expected_result

String

the state or behavior that should be observable when the action has been performed, format is html)

custom_fields

Array

the custom fields of that test step

custom_fields[].code

String

the code of the custom field

custom_fields[].value

Varies

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

id

Number

the id of the step

test_case

Object

the test case this step is part of

index

Number

the index of current step in the test case

custom_fields[].label

String

the label of the custom field

_links

Object

related links

Relation Description

self

link to this step

test-case

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

_type

String

the type of step

delegate_parameter_values

String

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.

index

Number

the index of the step in the test case

called_dataset

Object

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

id

Number

the id of the step

_links

Object

related links

Relation Description

self

link to this step

test-case

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

_type

String

the type of step

index

Number

the index of the step in the test case

keyword

String

the part which gives structure and meaning to an action word. Possible values are : GIVEN, WHEN, THEN, BUT, AND

action

String

the action of the step

datatable

String

the datatable of the step

docstring

String

the docstring of the step

comment

String

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

id

Number

the id of the step

test_case

Object

the test case this step is part of

_links

Object

related links

Relation Description

self

link to this step

keyword-test-case

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

Table 1. /api/rest/latest/test-steps/{ids}
Parameter Description

ids

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

Table 1. /api/rest/latest/test-cases/{testCaseId}/steps
Parameter Description

testCaseId

the id of the test case of which to add new test step

Request parameters

Parameter Description

fields

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

_type

String

the type of step

action

String

the action to be accomplished, format is html

expected_result

String

the state or behavior that should be observable when the action has been performed, format is html)

custom_fields

Array

the custom fields of that test step

custom_fields[].code

String

the code of the custom field

custom_fields[].value

Varies

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

id

Number

the id of the step

test_case

Object

the test case this step is part of

index

Number

the index of current step in the test case

custom_fields[].label

String

the label of the custom field

_links

Object

related links

Relation Description

self

link to this step

test-case

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

_type

String

the type of step

delegate_parameter_values

Boolean

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.

called_test_case

Object

the test case called by this step

called_dataset

Object

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

id

Number

the id of the step

test_case

Object

the test case this step belongs to

index

Number

the index of the step in the test case

_links

Object

related links

Relation Description

self

link to this step

test-case

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

_type

String

the type of step

keyword

String

the part which gives structure and meaning to an action word. Possible values are : GIVEN, WHEN, THEN, BUT, AND

action

String

the action of the step

datatable

String

the datatable of the step

docstring

String

the docstring of the step

comment

String

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

id

Number

the id of the step

test_case

Object

the keyword test case this keyword step is part of

index

Number

the index of current keyword step in the keyword test case

_links

Object

related links

Relation Description

self

link to this keyword step

keyword-test-case

link to the keyword test case where this keyword step belongs

A POST to test-steps/{id}/coverages/{requirementIds} links the requirements to the test step.

Table 1. /api/rest/latest/test-steps/{id}/coverages/{requirementIds}
Parameter Description

id

the id of the test step

requirementIds

the ids of the requirements to link

POST /api/rest/latest/test-steps/235/coverages/12,13,14 HTTP/1.1
Accept: application/json
Host: localhost:8080
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"
    }
  }
}

A DELETE to test-steps/{id}/coverages/{requirementIds} unlinks the requirements from the test step.

Table 1. /api/rest/latest/test-steps/{id}/coverages/{requirementIds}
Parameter Description

id

the id of the test step

requirementIds

the ids of the requirements to unlink

DELETE /api/rest/latest/test-steps/235/coverages/12,14 HTTP/1.1
Accept: application/json
Host: localhost:8080