Applies to TestComplete 14.0, last modified on January 24, 2019

About

Behavior-driven development (BDD) is a software development methodology that combines technical aspects and business interests. It implies that the team decides what to test and to what extent, and creates test scenarios in a simple language (like Gherkin) that is understandable by even non-technical-savvy employees.

In TestComplete, you can create such BDD tests against desktop, web and mobile applications, you can also automate their test steps and run these tests daily.

Scenarios

To create and run BDD tests in TestComplete, you use the Scenarios project item. It contains child items (called features) that correspond to .feature files or feature descriptions used by such tools as HipTest or Cucumber:

BDD scenarios in TestComplete

Click the image to enlarge it.

In TestComplete, you can write scenarios anew, import them from HipTest, or load from feature files on your hard drive.

Scenarios are written in Gherkin – a special language that is used for creating BDD tests. TestComplete supports both English and native-language Gherkin keywords.

Workflow

BDD scenarios describe test cases in a plain-text form, and though they use Gherkin keywords, they can be  created by non-technical-savvy employees. Quite often, they are written by product managers or subject matter experts, and are automated by the QA team or special automation engineers.

The latter can import scenarios to TestComplete and automate the scenarios’ test steps. After that, they can include BDD scenarios in automated tests that run on a daily basis.

BDD workflow

How automation works

  • After you create a feature file or import it to TestComplete, click Generate Step Definitions to command TestComplete to create script functions that will implement a step. You will then see the created code in the script editor. For instance, here is how the steps look like in JavaScript:

    Generated script functions

    Click the image to enlarge it.

    You can also create script code for BDD tests in Python, VBScript, JavaScript, C++Script and C#Script. DelphiScript is not supported.

  • As you can see, for each function, TestComplete also generates an expression that links a function to a test step:

    A binding expression

    When you run a scenario, TestComplete will run the script functions that match the test steps of this scenario.

    For more information on the syntax of these expressions, see Binding Script Functions to Test Steps.

  • After you generate script functions for test steps, you can create function bodies. You can either write script code manually, or record a script. See Create Test Step Scripts.

  • After you create script code, you can run your BDD scenarios. The easiest way to do this is to right-click a scenario in the Gherkin editor and to select Run This Scenario from the context menu:

    Run BDD tests from Gherkin editor

    You can also run BDD tests as test items of your project, from scripts and from the command line. See Run BDD Tests. In other words, you can easily include BDD tests in your automated test set and run them on a regular basis.

  • Tip: It is considered to be a good approach to assign tags to feature files and individual scenarios in them, and then run BDD tests by tags. See Tags for complete information on this.

HipTest integration

In TestComplete, you can create BDD scenarios anew in the Gherkin editor, import them from a feature file on your hard drive, or import them from HipTest. HipTest is a cloud-based test platform by SmartBear for Agile testing and behavior-driven development. It’s a feature-rich solution that enables you to create BDD scenarios quickly and easily, maintain these scenarios and run them.

TestComplete tightly integrates with HipTest. Your team can continue using HipTest to create and update BDD scenarios, and use TestComplete to automate and run these scenarios. This approach helps you save time and resources needed to run tests and work more on test automation, increasing the number of automated tests and test coverage.

For complete information on HipTest support in TestComplete, see HipTest Integration.

Sample project to explore

TestComplete includes a sample BDD test project that contains a few scenarios and scripts that automate the test steps. To open the project, simply select Samples > BDD on the TestComplete start page:

Open the BDD sample project from the Start page

Click the image to enlarge it.

You can also open the project file from your hard drive: <TestComplete 14 Samples>\BDD\WebStore_BDDSample.pjs.

Further reading

See Also

TestComplete 14 Documentation

Highlight search results