SpecSync Documentation
Getting StartedConfigurationGuidesDownloads
Azure DevOps
Azure DevOps
  • Introduction to SpecSync for Azure DevOps
  • Getting started
    • Getting started using SpecFlow
    • Getting started using Cucumber or other Gherkin-based BDD tool
  • Installation & Setup
    • Install as .NET tool
    • Install as .NET Console App
    • Install as native binaries for Linux or macOS
    • Install as Docker image
    • Setup and Configure
  • Features
    • Push features
      • Pushing scenario changes to Test Cases
      • Configuring the format of the synchronized test cases
      • Synchronizing Scenario Outlines
      • Add new Test Cases to an Area or an Iteration
      • Mark Test Cases as Automated
      • Setting Test Case state on change
      • Update Test Case fields
      • Attach files to Test Cases using tags
      • Customization: Setting Test Case fields with default values
      • Customization: Update custom Test Case fields on push
      • Customization: Ignoring marked Test Case steps
      • Customization: Ignoring Test Case Tags
      • Customization: Ignore non-supported local tags
      • Customization: Mapping tags
      • Customization: Synchronizing scenarios from feature branches
      • Customization: Reset Test Case state after change
      • Customization: Automatically link changed Test Cases
      • Customization: Synchronize linked artifact titles
      • Customization: Add Test Cases to Suites
      • Customization: Do not synchronize title
    • Pull features
      • Pulling Test Case changes to local scenarios
    • Common synchronization features
      • Configuration key
      • Remote scope
      • Linking Work Items using tags
      • Synchronizing Test Case hierarchies using Test Suites
      • Include synchronized Test Cases to a Test Suite (deprecated)
      • Excluding scenarios from synchronization
      • Synchronization conflict resolution
      • Re-link scenarios to new Test Cases
    • Test result publishing features
      • Publishing test result files
      • Support for Azure DevOps Test Plan / Test Suite based test execution
      • Customization: Publishing test results to multiple Test Suites
    • General features
      • Azure DevOps authentication options
      • Configuration file
      • Hierarchical configuration files
      • Local test case conditions
      • Configuration wizards
      • SpecSync plugins
    • Customizations
    • Plugin list
  • Licensing
  • Guides
    • What is my Azure DevOps project URL?
    • How to define the local feature-set to be synchronized
    • Filters and scopes
    • How to synchronize automated test cases
    • How to use SpecSync from build or release pipeline
    • How to publish test results from pipelines using the VSTest task
    • How to use the SpecSync Azure DevOps pipeline tasks
    • How to link GitHub pull requests
    • How to upgrade to a newer version of SpecSync
    • How to attach files to test results
    • Using SpecSync with SpecFlow+
    • Using SpecSync with Cucumber
    • Using SpecSync with Cypress
    • Using SpecSync with Postman
    • Using SpecSync with TestNG
    • Using SpecSync on macOS or Linux
    • Using SpecSync inside a Docker container
    • How to handle Test Cases of multiple parallel application releases
    • Migrating from SpecSync v3 to v5
    • Migrating from SpecSync v2 to v3
    • Migrating from SpecSync v1 to v2
  • Changelog
  • Release Model and Roadmap
  • Downloads
  • Reference
    • Command line reference
      • init
      • upgrade
      • push
      • pull
      • publish-test-results
      • re-link
      • version
    • Configuration reference
      • toolSettings
      • local
      • remote
      • knownRemotes
      • synchronization
        • push
        • pull
        • automation
        • state
        • areaPath
        • iterationPath
        • links
        • attachments
        • format
        • fieldUpdates
      • hierarchies
      • publishTestResults
      • specFlow
      • reqnroll
      • customizations
    • Compatibility
    • Older versions
  • Contact
    • SpecSync Support
    • Troubleshooting
    • FAQ
  • Project Website
Powered by GitBook
On this page
  • Synchronize all scenarios from a folder
  • Synchronize all scenarios from a SpecFlow or Reqnroll project
  • Synchronize only selected scenarios from the feature files
  • Synchronizing multiple feature-sets from one local repository
  • Configuring multiple feature-sets by placing a configuration file in each folder
  • Configuring multiple feature-sets by placing multiple configuration files to the root folder
  • Synchronize multiple feature-sets from the same folder

Was this helpful?

  1. Guides

How to define the local feature-set to be synchronized

PreviousWhat is my Azure DevOps project URL?NextFilters and scopes

Last updated 1 month ago

Was this helpful?

When synchronizing the scenarios from a local repository you can define different set of scenarios to be synchronized. Maybe you want to synchronize all scenarios within the repository in one batch but maybe you need to have separate synchronization rules for the frontend and the backend scenarios.

The feature-set to be synchronized is called the local scope in SpecSync and can be specified using the . You can learn about local and and the difference between scopes and filers in the guide .

In this guide you will find the most common scenarios and the necessary steps to do this.

The local scope is used to define the set of feature files to be synchronized using the or to identify the test results using the . To consider the Test Cases to synchronize back, using the , the remote scope can be specified. See more information about this in the documentation.

Synchronize all scenarios from a folder

If you want to synchronize all scenarios from a folder (e.g. the features folder of your local repository), the easiest solution is to place your SpecSync configuration file into that folder. As the default settings of the local scope configuration take all feature files from a folder (and its sub-folders), you don't even have to specify anything in the local configuration.

The default local scope configuration in this case is equivalent to this settings:

{
  ...
  "local": {
    // these are the default settings for configurations in regular folders, so you don't even need to set these
    "featureFileSource": {
      "type": "folder",
      "folder": "."
    }
  },
  ...
}

If for some reason you don't want to put the configuration file into the folder of your feature files, you can set the folder to be used explicitly using the local/featureFileSource/folder setting.

In the following example, the specsync.json configuration file is in the local repository root folder, but the feature files are in the src/features folder.

{
  ...
  "local": {
    "featureFileSource": {
      "type": "folder",
      "folder": "src/features"
    }
  },
  ...
}

The path you specify in the local/featureFileSource/folder setting is relative to the location of the configuration file but can also contain relative paths above the current folder, e.g. ../features.

Synchronize all scenarios from a SpecFlow or Reqnroll project

Although modern .NET projects include automatically all files within the project folder you can explicitly exclude some files with a .NET project. If you want to synchronize those feature files that are included in the .NET project, you simply have to put the specsync.json configuration file to the project root folder and do not specify anything as local/featureFileSource.

Alternatively you can specify the project file explicitly:

{
  ...
  "local": {
    "featureFileSource": {
      "type": "projectFile",
      "filePath": "MyProject\\MyProjectFile.csproj"
    }
  },
  ...
}

Synchronize only selected scenarios from the feature files

Regardless whether you have used the folder-based or the .NET project based approach, you can further limit the scenarios or the feature files to be applied.

You can limit the synchronized scenarios to the ones match to a tag expression (e.g. everything tagged with @important) or you can specify a set of feature file paths globs, that should be included (e.g. **/Important*.feature). You can even combine these two options.

Synchronizing multiple feature-sets from one local repository

If the local repository contains multiple sets of feature files that need to be synchronized separately (e.g. frontend and backend related scenarios), you can create multiple SpecSync configuration files for each of them.

For organizing the configuration files for this setup, you have two main options to choose from: the configuration per folder and the different configuration files in root option. These options are shown in the sections below.

Configuring multiple feature-sets by placing a configuration file in each folder

Let's imagine the following local repository structure

src/
  backend/
    features/
      backend_feature_a.feature
      backend_feature_a.feature
      specsync.json
  frontend/
    features/
      frontend_feature_c.feature
      frontend_feature_d.feature
      specsync.json
  specsync.json

In this setup, there is a SpecSync configuration file in the src folder, that contains all common settings (e.g. repository URL), but this is not used directly for synchronization. For example:

{
  "remote": { // common target URL
    "projectUrl": "https://dev.azure.com/myorganization/MyProject",
  },
  "synchronization": { // some common synchronization settings
    "automation": {
      "enabled": true
    }
  }
}

The specsync.json files in src/backend/features and src/frontend/features contain all the frontend and backend specific details (e.g. the Test Suite to be synchronize the scenarios to). For example the one in the backend would look like:

{
  "remote": { 
    "testSuite": {
      "name": "Backend BDD Scenarios"
    }
  }
}

If the synchronization is performed from the specific features folder, SpecSync will automatically use the specific configuration file and also automatically load the specsync.json file as well from the src folder, because all parent folders are searched for configuration files.

...src/backend/features> dotnet specsync push

In order to avoid accidental synchronizations performed from the root folder using the parent configuration file, you can consider renaming it to a different name (e.g. specsync-parent.json). In this case you need to specify the path of the parent configuration in the specific configuration files using the toolSettings/parentConfig setting.

You can also invoke the synchronization from another folder, but in this case you need to specify the path to the configuration file.

...src> dotnet specsync push backend/features/specsync.json

Configuring multiple feature-sets by placing multiple configuration files to the root folder

For this option, let's imagine a folder structure, like this:

src/
  backend/
    features/
      backend_feature_a.feature
      backend_feature_a.feature
  frontend/
    features/
      frontend_feature_c.feature
      frontend_feature_d.feature
  specsync-parent.json
  specsync-backend.json
  specsync-frontend.json

With this approach all configuration files are stored in a root folder (in the src folder in our case).

The specsync-parent.json contains the common settings (e.g. repository URL). You can find an example for the file content in the previous section where we discussed the configuration per folder option.

The specsync-backend.json and the specsync-frontend.json files contain the settings specific to the different feature-sets, but since they are placed in the root folder now, they need to have the necessary settings to configure the local scope and also the parent configuration file. The specsync-backend.json configuration file can look like this:

{
  "toolSettings": {
    "parentConfig": "specsync-parent.json"
  },
  "local": {
    "featureFileSource": {
      "type": "folder",
      "folder": "backend/features"
    }
  },
  "remote": { 
    "testSuite": {
      "name": "Backend BDD Scenarios"
    }
  }
}

The synchronization for the frontend or the backend can be invoked by specifying the configuration file:

...src> dotnet specsync push specsync-backend.json

Synchronize multiple feature-sets from the same folder

The different configuration files in root option that was shown in the previous section can also be used if the feature files are all in the same folder, and the scenarios are only separated by tags or file name conventions.

Let's imagine the following folder structure:

src/
  features/
    common_features_a.feature
    backend_feature_b.feature
    frontend_feature_c.feature
  specsync-parent.json
  specsync-backend.json
  specsync-frontend.json

The scenarios in the backend_feature_b.feature are all tagged with @backend, the scenarios in frontend_feature_c.feature with @frontend and the ones in common_features_a.feature are tagged with both @frontend and @backend.

The specsync-parent.json contains the common settings and looks similar to the ones in the previous sections, but here we can even specify the main target folder:

{
  "local": {
    "featureFileSource": {
      "type": "folder",
      "folder": "features" // the common target folder
    }
  },
  "remote": { // common target URL
    "projectUrl": "https://dev.azure.com/myorganization/MyProject",
  },
  "synchronization": { // some common synchronization settings
    "automation": {
      "enabled": true
    }
  }
}

The specsync-backend.json and the specsync-frontend.json files contain the settings specific to the different feature-sets by specifying the local scope using tags. The specsync-backend.json configuration file can look like this:

{
  "toolSettings": {
    "parentConfig": "specsync-parent.json"
  },
  "local": {
    "tags": "@backend"
  },
  "remote": { 
    "testSuite": {
      "name": "Backend BDD Scenarios"
    }
  }
}

The synchronization for the frontend or the backend can be invoked by specifying the configuration file:

...src> dotnet specsync push specsync-backend.json

These settings can be configured with the local/tags and the local/sourceFiles settings. You can read more information about these options in the page.

In many cases some of the configuration options are common for the multiple feature-sets that you don't want to maintain separately in the configuration files of the particular feature sets. For this you can use the and specify the common settings in a parent configuration file.

The different configuration files in root option can also be used if the feature files are all in the same folder, and the scenarios are only separated by tags or file name conventions. This approach is shown in the section below.

Instead of the local/tags you could also separate the scenarios by file name patterns using the local/sourceFiles setting. You can find more information about this in the page.

local configuration file settings
remote scopes
Filters and scopes
push command
publish-test-results command
pull command
Remote scope
Excluding scenarios from synchronization
hierarchical configuration files
Excluding scenarios from synchronization
Synchronize multiple feature-sets from the same folder