Tags

Tags are used to provide additional information for the request and contribute to a better control over deduplication. A request can only contain a unique tag with same name and value.

There are three types of tags.

  1. Case

  2. Label

  3. Annotation

1. Case

Case is a tag that is used to create a mock at a particular branching which needs to be covered in a request and does not let it get deduplicated if there is a version of the same request already present.

Case is created with the following syntax in source code.

htSdk.htTags.addCase({name: 'case name', value: 'case value'});

Case contributes to the deduplicating hash and essentially creates a new version of the request if the latter was already present. Typically this is used to create different versions of the same request to increase code coverage and cover all branching statements.

Case can also be added in the root context of an application. If a case is added in root context then the same case is inserted in every incoming request when the server span is created.

Case is created at root context with the following syntax in source code.

htSdk.htRootTags.addRootCase({name: 'case name', value: 'case value'});

2. Label

Label is a tag that is used to create a mock inside a particular route to avoid more versions of the same request due to difference in response schema. If there is a label inside a request, then only the cases and labels are considered for creating the deduplicating hash value thereby retaining the desired version of the request.

Label is created with the following syntax in source code.

htSdk.htTags.addLabel({name: 'label name', value: 'label value'});

Label can also be added in the root context of an application. If a label is added in root context then the same label is inserted in every incoming request when the server span is created.

Label is created at root context with the following syntax in source code.

htSdk.htRootTags.addRootLabel({name: 'label name', value: 'label value'});

3. Annotation

Annotation is a tag that is used to create an unimportant mock inside a route to provide additional context to the request. This does not contribute to the deduplicating hash.

Annotation is created with the following syntax in source code.

htSdk.htTags.addAnnotation({name: 'annotation name', value: 'annotation value'});

Annotation can also be added in the root context of an application. If a annotation is added in root context then the same annotation is inserted in every incoming request when the server span is created.

Annotation is created at root context with the following syntax in source code.

htSdk.htRootTags.addRootAnnotation({name: 'annotation name', value: 'annotation value'});

Last updated