Synchronize Scenarios

Applies to TestComplete 15.45, last modified on December 01, 2022

About synchronization

When you import BDD scenarios from CucumberStudio to your TestComplete project, the latter copies feature files from a CucumberStudio project to your computer, and the projects become bound to each other. You may want to synchronize feature files in bound projects, that is, you may want the changes made to CucumberStudio scenarios to become available to automation engineers in your TestComplete project, and, vice versa, the changes made to feature files by automation engineers in TestComplete become available to your teammates who are working on scenarios in CucumberStudio.

Note on difference in file structure

CucumberStudio organizes test scenarios into folders and subfolders. To emulate this structure, TestComplete creates a feature file and, optionally, a folder for each “CucumberStudio” folder. For detailed explanation, see Difference in File Structure. Keep this in mind when syncing scenarios.

CucumberStudio-to-TestComplete sync

You can obtain files from CucumberStudio automatically or manually. If you choose automatic synchronization, you can also select the moment when it should occur: when you open your project in TestComplete, or when you run a BDD test in TestComplete, or in both these cases.

Option 1 – Automatic sync

You can command TestComplete to obtain feature files automatically every time you run BDD scenarios from TestComplete, or when you open your test project in TestComplete, or in both these cases. The first approach is helpful if your team changes scenarios in CucumberStudio frequently. The second approach is helpful when the scenarios are not changed so frequently, but you want to keep track of changes. You enable these types of synchronization in your project properties in TestComplete:

  1. Open the project property editor. To do this:

    • Right-click the project node in the Project Explorer panel and select Edit > Properties from the context menu.

      – or –

      Double-click the project node to open the project editor, and then go to the Properties tab.

    • Select the Synchronize feature files on project opening and Synchronize feature files before test run check boxes:

      Enable automatic synchronization with CucumberStudio in project properties

      Click the image to enlarge it.

      Select File > Save from the main menu to save the changes.

    You can select only one of these check boxes or both. By default, in new projects, these settings are on.

    The Synchronize test cases before test run setting also works with Synchronize test run. See below for details.

When to disable auto sync

In some cases, you may want to disable automatic synchronization. This might happen if your team is actively changing scenarios in CucumberStudio, and you need to continue working on and running previous scenario versions. In this case, you can disable both settings and synchronize projects manually when it is needed. See below.

Option 2 – Manual sync

You can synchronize your TestComplete with CucumberStudio at any time manually. To do this, simply right-click the project node in the Project Explorer and select Update from CucumberStudio from the context menu:

Manual synchronization with CucumberStudio

TestComplete-to-CucumberStudio sync

You can edit imported feature files in TestComplete, delete them and create new feature files and pass your changes to CucumberStudio. This happens automatically when you save your changes in TestComplete; the latter automatically forwards them to the bound CucumberStudio project. The files to be synchronized depend on whether you are saving changes to a feature file, to the Scenarios node or to the entire project.

If you save changes to a feature file ...

... then TestComplete synchronizes that feature file only. It sends it to CucumberStudio and overwrites the CucumberStudio version of the file with your version.

This happens, for example, when you are editing a feature file in the Gherkin editor and press Ctrl+S to save the changes.

If you save changes to your project or Scenarios node ...

... TestComplete synchronizes all the features files in your project. It sends them to CucumberStudio and replaces the CucumberStudio versions of the files with your version.

This happens, for example, when you choose File > Save All from the main menu or when the Scenarios node is selected in the Project Explorer, and select File > Save from the main menu.

What files are updated

  • Important: When getting files from CucumberStudio to TestComplete, the latter replaces the existing feature files in the test project with the CucumberStudio files. All the changes in your TestComplete project that have not been synced with CucumberStudio are lost.
    This works in the reverse order as well: when passing changes from TestComplete to CucumberStudio, TestComplete replaces the folders and test scenarios on the CucumberStudio side with the feature files and scenarios you have in your TestComplete project. If some “feature” exists in CucumberStudio, but doesn’t exist in your TestComplete project, it will be removed from CucumberStudio. Be aware!

  • In CucumberStudio, BDD scenarios can differ from one test run to another. TestComplete always synchronizes with scenario versions from the Scenarios collection of your CucumberStudio project. It doesn’t synchronize with test runs.

    If you send changes from TestComplete to CucumberStudio and want the changes to go to some test run, select this test run in the Test run project property and enable the Synchronize scenarios in the CucumberStudio test run property. Synchronization with archived test runs is not possible.

Some changes are not allowed in bound TestComplete projects and cannot be synchronized:

  • You cannot rename an imported feature file in the Project Explorer, nor you can rename an imported feature in the Gherkin editor (that is, you cannot change the first line of the feature description). The feature name serves as an identifier and is required for synchronization. If you want to rename a feature, do this on the CucumberStudio side.

  • In bound projects, the TestComplete Scenarios node can have only one or two of the following items as direct children:

    • A feature file that stores test scenarios corresponding to the test scenarios in the root CucumberStudio folder,

    • A folder that stores scenarios at child levels.

    If you have both the file and the folder, their names must coincide.

    In other words, you cannot make your feature files child items of the Scenarios item. Add them to subfolders below Scenarios.

  • Also, to prevent data loss and to avoid possible issues during synchronization, we recommend that you don't edit imported feature files outside TestComplete. If you need to change a scenario or a feature file, do this in TestComplete, or do this in CucumberStudio and then import the changes to TestComplete.

Sync test runs

In CucumberStudio, scenario versions may differ from one test run to another. If you want a test run to use the latest scenario version, you call the Synchronize command for it in CucumberStudio:

The Synchronize command in CucumberStudio

Click the image to enlarge it.

To implement this behavior in TestComplete, select the Synchronize scenarios in the CucumberStudio test run check box in project properties in TestComplete. This option works only if you synchronize scenarios before test runs:

  • When you command TestComplete to launch a BDD scenario, it checks the Synchronize test cases before test run setting of your project.

  • If this setting is on, and if Synchronize CucumberStudio test run is on, then …

  • … before synchronizing scenarios, TestComplete calls CucumberStudio’s Synchronize command for the test run you are using (this is the test run that the Test run project property specifies).

  • After this synchronization is over, TestComplete starts synchronizing feature files in the project with feature files from CucumberStudio.

  • And, after this synchronization is done, it launches the test.

Sync test results

TestComplete can also post results of BDD scenarios to CucumberStudio. See Upload Results.

See Also

CucumberStudio Integration
Bind TestComplete Project to CucumberStudio Project
Import CucumberStudio Scenarios
Upload Results

Highlight search results