Tags Object

Applies to TestComplete 15.63, last modified on April 10, 2024

Description

This object provides a scripting interface to tags assigned to a BDD scenario or feature file.

To obtain this object, you use code like this –

JavaScript

let tags = Features.Item(0).Tags; // Feature tags
let tags = Features.Item(0).Scenarios.Item(0).Tags; // Scenario tags

Python

tags = Features.Item[0].Tags # Feature tags
tags = Features.Item[0].Scenarios.Item[0].Tags # Scenario tags

VBScript

Set tags = Features.Item(0).Tags ' Feature tags
Set tags = Features.Item(0).Scenarios.Item(0).Tags ' Scenario tags

DelphiScript

  // DelphiScript does not support BDD.

C++Script, C#Script

var tags = Features["Item"](0)["Tags"] // Feature tags
var tags = Features["Item"](0)["Scenarios"]["Item"](0)["Tags"] // Scenario tags

Members

The object has the following methods and properties:

Member Description
Contains(Tag)

Checks if the tags collection includes the tag specified by the Tag parameter. The method returns true or false as a result of the check.

When specifying the tag, put the @ symbol before the tag name: @my-tag-name.

Count

Returns the number of tags assigned to a scenario or feature.

Item(Index)

Returns a tag name (string) by the tag’s index (zero-based) in the collection. The resulting value includes the @ symbol.

Example

For examples of using the Tags collection in scripts, see the following topic:

See Also

Behavior-Driven Development (BDD) With TestComplete
Tags
Scripting

Highlight search results