Skip to content

Visual Studio Extensions (v2.x)

Suremaker edited this page Jan 13, 2019 · 1 revision

Page version: 3.x / 1.x

Visual Studio Extensions

The LightBDD project offers Visual Studio Extension to improve experience of working with LightBDD.

The VSIX extension can be installed from:

  • Visual Studio Gallery, or
  • directly from Visual Studio via Tools > Extensions and Updates, by searching for LightBDD.

The extensions are available for Visual Studio 2012 and newer.

Item Templates

The Item Templates allows to create a new feature test class for all supported test frameworks.

When used, it will create a partial class consisting of:

  • [feature name].cs file with feature class attributes ([FeatureDescription],[Label]) and sample scenario methods,
  • [feature name].Steps.cs nested file with step definitions.

Those templates are designed for old csproj formats, where nested files are properly supported.
For new csproj format it is better to create those classes manually and use code snippets for scenario generation.

Project Templates

Since LightBDD version 2.5.0, it is possible to use Project Templates to create new LightBDD projects for all supported test frameworks.

When used, a new project will be created using new csproj format and it will contain:

  • package reference to selected LightBDD integration package, Microsoft.NET.Test.Sdk and selected test framework,
  • LightBDD configuration file, such as ConfiguredLightBddScope.cs,
  • sample feature file.

Each project template has a .NET Framework version and .NET Core version if supported.

Code snippets

Since LightBDD version 2.5.0, it is possible to use a set of predefined code snippets to generate scenarios and composite steps.

Here is a list of currently supported snippets:

  • Scenario snippets:
    • lbscen - scenario (basic and extended syntax),
    • lbscena - async scenario (basic and extended syntax),
    • lbscenc - contextual scenario,
    • lbscenca - async contextual scenario,
  • Composite step snippets:
    • lbcomp - composite step (basic and extended syntax),
    • lbcompa - async composite step (basic and extended syntax),
    • lbcompc - contextual composite step,
    • lbcompca - async contextual composite step.

The snippets works with plain Visual Studio (i.e. they do not need Resharper to be present).
If Resharper is present however, the snippets can be displayed by pressing: Ctrl+J.

Each LightBDD snippet name starts with lb prefix which makes them easy to discover.
When used, they will generate selected code and add all required namespaces for it.

Continue reading: Migrating LightBDD Versions

Clone this wiki locally