Scenario Object

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

Description

This object provides a scripting interface to a BDD scenario defined in your TestComplete project. To obtain the object, you use code like this –

JavaScript

let scenario = Features.Item(0).Scenarios.Item(0)

Python

scenario = Features.Item[0].Scenarios.Item[0]

VBScript

Set scenario = Features.Item(0).Scenarios.Item(0)

DelphiScript

  // DelphiScript does not support BDD.

C++Script, C#Script

var scenario = Features["Item"](0)["Scenarios"]["Item"](0)

Members

The object has the following methods and properties:

Member Description
Description

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

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

Name

A string property that returns the first line of the scenario description, the text after the Scenario: keyword.

This line identifies the scenario in the test log and in TestComplete’s panels and dialogs.

The property value doesn’t include leading and trailing spaces.

Run()

A method that runs the scenario. The method does not return any value. Also, the method does not return the execution control until the scenario run is over.

Tags

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

Example

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

See Also

Behavior-Driven Development (BDD) With TestComplete
Scripting

Highlight search results