description |
---|
API Reference - Gets a test signature |
The test signature is a unique hash identifier for a specific test in our system. It is based in the combination of the organization ID, the project ID, the spec file where the test belongs to and the test title.
This combination ensures uniqueness to identify a specific test for metrics purposes and runs completion awareness.
POST
v1/signature/test
Request Body
{
"projectId": "your project id",
"specFilePath": "the spec file path",
"testTitle": ["title part 1", "title part 2"]
}
The properties sent in the request are needed to get the correct test signature.
Property | Type | Required | Description |
---|---|---|---|
projectId | String | Yes | Refers to the project ID where the test can/will be found. projects |
specFilePath | String | Yes | Is the spec file name with its full relative path, where the test belongs to. spec-files.md |
testTitle | Array<String> | String | Yes | Title of the test that is usually divided in multiple strings. Can also be sent as an string by copying directly from the dashboard. |
The spec file path is a string but it may be just the name of the spec file like this example:
Spec File Path with file name with extension
Can also be a name without file extension (usually in JUnit payloads)
Spec File Path with common name
Or might also be a full relative path to a file
Spec file path
It is important that the spec file path is set exactly to how it is reported to Currents otherwise it will not return a test signature that matches a test reported to Currents.
The test title in Currents is always an array reported by the framework and refers to the title of the test.
This array can have a single element and show as a single phrase:
Test title with single element
Or can also be made up of multiple elements, like when there are multiple nested describe
groups and within those the it
functions defining each test. For this case the title looks like this:
Test title with multiple elements
This last example can be visualized as follows in an array:
[
"Rended Embed pages",
"should have a 200 resonse and expected response headers"
]
In the spec file might look like this:
describe('Rended Embed pages', function() {
it('should have a 200 resonse and expected response headers', function() { ... });
});
The Test signature endpoint can also accept the string copied from the dashboard as testTitle
property for ease of use, meaning you could simply send the title you see in the dashboard instead of an array:
{
"projectId": "your project id",
"specFilePath": "the spec file path",
"testTitle": "Rended Embed pages > should have a 200 response and expected response headers"
}
{% hint style="info" %} It is important to understand how the Spec File Path and Test Title is formed so the information sent to the API is correct. {% endhint %}
{% tabs %} {% tab title="200: OK Successful Response" %} {% code overflow="wrap" %}
type ResponsePayload = {
status: "OK";
data: {
signature: string;
}
};
{% endcode %} {% endtab %}
{% tab title="400: FAILED Bad Request " %}
type ResponsePayload = {
status: "FAILED";
error: string;
};
{% endtab %} {% endtabs %}