Run Published Tests By Tag
Description
The Run Published Test By Tag endpoint executes all of the published tests within an API Hook's scope that match the tags specified in the request body. See Tagging a Test for more information on how to tag a test.
HTTP Request
POST <API-Hook-URL>/tests/run/tag
Sample Method Invocation
curl -X POST \
-H X-API-Key:{API-Key} \
-H X-API-Secret:{API-Secret} \
-H Content-Type:application/json \
-d '
{
"options": {
"allAssertions": boolean,
"JUnitFormat": boolean
},
"variables": {
string: string,
},
"tags": {
"tagList": array[string],
"operator": enum['not' or 'and' or 'or']
}
}
' \
<API-Hook-URL>/tests/run/tag
Header Parameters
MIME type: application/json
{
options: {
allAssertions: boolean,
JUnitFormat: boolean
},
variables: {
string: string,
},
tags: {
tagList: array[string],
operator: enum['not' or 'and' or 'or']
}
}
Body Parameters
options(Only required if providing a child element)- A wrapper object for the containing options on how what data should be returned in the response, or how the response should be formatted.
- Child Elements:
allAssertions(Optional)- When
false, only the results of failing assertions in the test are returned. Whentrue, all assertions in the test are returned.allAssertionsisfalseby default.
- When
JUnitFormat(Optional)- When
false,application/jsonformat is returned for the test results. Whentrue,text/xmlJUnit format is used for the test results (seetext/xmlresponse).JUnitFormatisfalseby default.
- When
variables(Optional)- The variables section is used to pass a list of named variables and their values into the tests being run. It is only used by tests that have been written to make use of variables, and have values stored alongside them. Declaring the variable name as the object key, and its new value as the key's value (as type string), will overwrite the current value of the variable in the test which shares its name with the object key.
tags(Required)- A wrapper object containing both the list of tags and the operator to use on them.
- Child Elements:
tagList(Required)- The list of tags which correspond to the tests you want to execute or ignore (see
operatorelement).
- The list of tags which correspond to the tests you want to execute or ignore (see
operator(Required)- The operator indicates how to treat the list of tags and can be either one of three values:
not,and,or.- The
notoperator will omit executing any test within the API Hook's scope that has been tagged with a tag listed in thetagList. - The
andoperator will include any test within the API Hook's scope that has been tagged with all the tags provided in thetagList. - The
oroperator will include any test within the API Hook's scope that has been tagged with at least one of the tags provided in thetagList.
- The
- The operator indicates how to treat the list of tags and can be either one of three values:
MIME type: application/json
application/json
[
{
testRunId: string,
testId: string,
testName: string,
location: string,
initiated: string,
duration: integer,
status: enum['passed' or 'failed'],
reportUrl: string,
results: {
warningsCount: integer,
failureCount: integer,
httpFailures: array[object],
criticalFailures: array[object],
assertions: array[object]
}
}
]
Response Description
-
testRunID- ID of the test run.
-
testId- ID of the test which was executed.
-
testName- Name of the test.
-
location- Location of the agent which excuted the test.
-
initiated- Date and time when the test was initiated.
-
duration- Total duration of the test run in seconds.
-
status- Overall result of the test.
-
reportUrl- URL to the test run report.
-
results- A wrapper object containing the results of the test run.
- Child Elements:
warningsCount- Count of the HTTP warnings returned by the test assertions.
failureCount- Count of the HTTP status code responses that are greater than 400.
httpFailures- Description of failures whose HTTP Status response code is greater than or equal to 400.
criticalFailures- Description of failures whose HTTP Status response code is greater than or equal to 500.
assertions- A description of the assertions executed in the test. By default, only failing assertions will be listed.
MIME type: text/xml
<?xml version="1.0" encoding="UTF-8"?>
<testSuite name="" tests="" disabled="" errors="" failures="" timestamp="" time="">
<testcase name="" classname="" time="">
<failure message="" type="" />
</testcase>
</testSuite>
Response Description
-
<testSuite>- Child Elements:
<testCase> - Attributes:
name- Test Suite name.
tests- Number of published tests ran.
disabled- Number of disabled tests.
errors- Number of errors.
failures- Number of tests within the test suite that failed.
timestamp- Date and time the tests were ran.
time- Total duration of all test runs in seconds.
- Child Elements:
-
<testCase>- Child Elements:
<failure> - Attributes:
name- Test name.
classname- ID of the test which was executed.
time- Total duration of the test run in seconds.
- Child Elements:
-
<failure>- Attributes:
message- Failure message containing the expected and actual response.
type- Type of failure.
- Attributes: