In TestComplete, BDD scenarios are located in Feature files that are child items of the Scenarios project item:
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
Start creating a new project by selecting File > New Project from the main menu.
On the first page of the New Project wizard, select the BDD files check box.
On the next page of the wizard, select Create a new feature file and then click Finish:
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:
Adding new feature files to an existing project
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:
If the Project Explorer panel is hidden, select View > Project Explorer from the main menu to make it visible.
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:
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:
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.
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:
This will command TestComplete to generate script functions for test steps (
But). The generated code also has statements that link the generated functions to test steps.
Record or write manually script code for the generated functions. See Create Test Step Scripts.