Create Scenario Manually

Applies to TestComplete 15.62, last modified on March 19, 2024

In TestComplete, BDD scenarios are located in Feature files that are child items of the Scenarios project item:

Feature files in a TestComplete project

Click the image to enlarge it.

You edit these files and create BDD scenarios by writing Gherkin code in TestComplete’s Gherkin editor.

1. Create BDD feature files

You can command TestComplete to create feature files when you are creating a new project, or at any time later.

If you are creating a new project

  1. Start creating a new project by selecting File > New Project from the main menu.

  2. On the first page of the New Project wizard, select the BDD files check box.

  3. On the next page of the wizard, select Create a new feature file and then click Finish:

    Create a new feature file from the New Project wizard

    Click the image to enlarge it.

TestComplete will add the Scenarios project item to the new project and will create a new feature file. You will see it in the Project Explorer panel:

New BDD feature file in the Project Explorer

Adding new feature files to an existing project

  1. Add the Scenarios project item to your TestComplete project. To do this:

    • Right-click your project in the Project Explorer and select Add > New Item from the context menu.

    • In the subsequent dialog, select Scenarios and click OK:

      Adding the Scenarios project item

      Click the image to enlarge it.

      If the Project Explorer panel is hidden, select View > Project Explorer from the main menu to make it visible.

  2. Add a new feature file to Scenarios:

    • Right-click the Scenarios node in the Project Explorer and select Add > New Item from the context menu.

    • In the subsequent dialog, select the Feature type, specify a name and click OK:

      Add a new Feature project item

      Click the image to enlarge it.

      TestComplete will add the new Feature item to the project and will open its editor.

2. Write Gherkin code

After you create a Feature project item, you can create scenarios. You write them in the Gherkin language in the editor of the Feature item:

Generate step definitions

Click the image to enlarge it.

For information on keywords and syntax, see Gherkin Syntax in TestComplete.

3. Automate test steps

After the scenario is ready, automate it, that is, create script code that will simulate the needed user actions.

  1. To start faster, right-click somewhere within the Gherkin editor and select Generate Step Definitions from the context menu, or click this item on the editor toolbar:

    Generate step definitions

    Click the image to enlarge it.

    This will command TestComplete to generate script functions for test steps (Given, When, Then, And, But). The generated code also has statements that link the generated functions to test steps.

  2. Record or write manually script code for the generated functions. See Create Test Step Scripts.

See Also

Create BDD Scenarios

Highlight search results