Feature Object

Applies to TestComplete 14.71, last modified on April 22, 2021

Description

This object provides a scripting interface to a feature file of your TestComplete project. To obtain the object, you use code like this –

JavaScript

let feature = Features.Item(0)

Python

feature = Features.Item[0]

VBScript

Set feature = Features.Item(0)

DelphiScript

DelphiScript does not support BDD.

C++Script, C#Script

var feature = Features["Item"](0)

Members

The object has the following methods and properties:

Member Description
Description

A string property that returns the feature description, that is, all the lines of the description, except for the first line that follows the Feature: keyword (this line is returned by the Name property).

The property value includes the leading and trailing spaces that the description line might have.

Name

A string property that returns the first line of the feature description (the line after the Feature: keyword). This line identifies the feature in the test log and in TestComplete’s panels and dialogs.

The property value does not contain the leading and trailing spaces that the first line might have.

Run()

A method that runs all the scenarios defined in the feature file. The method runs scenarios in their order in the feature file.

The run is synchronous, that is, it does not exit until all the scenarios run or fail.

The method has no return value.

Scenarios

A property that returns a Scenarios object that provides a scripting interface to scenarios of the feature file.

Tags

A property that returns a Tags object that provides a scripting interface to tags assigned to the feature file.

Example

For examples of using Feature objects in scripts, see the following topics:

See Also

Behavior-Driven Development (BDD) With TestComplete
Scripting

Highlight search results