Tags - nripendra/xGherkin.net GitHub Wiki

Tag your features, tag your scenarios.

Tags are great way to organize features. They help to provide some meta information, or classify the features/scenarios.

Gherkin:

@authentication
Feature: Login

  @important
  Scenario: Login with proper credential

  Scenario: Login with wrong password

xGherkin.net:

[Tag("authentication")]
[Feature("Login")]
public class LoginFeatures
{
  [Tag("important")]
  [Scenario("Login with proper credential")]
  public void ProperCredential()
  {
  }

  [Scenario("Login with wrong password")]
  public void WrongPassword()
  {
  }
}

'Tag' attribute in xGherkin.net inherits from 'Trait' attribute of xunit.net framework, which means it is possible to filter tests using tags provided that the test runner supports filtering.

xGherkin.net does provide couple of commonly used convenience tags such as:

  • Sprint
  • PBI
  • Task
  • Bug
  • Issue

If you are doing scrum and managing projects in scrum boards like TFS scrum, then these tags may come handy. 'Issue' tag may come handy for github issues. If you want you can just create new tag by inheriting the Tag attribute or simply use Tag itself for generic solution.

e.g.:

[Tag("authentication"), Sprint("14"), PBI("4210"), Task("1248")]
[Feature("Login")]
public class LoginFeatures
{
  [Tag("important")]
  [Scenario("Login with proper credential")]
  public void ProperCredential()
  {
  }

  [Scenario("Login with wrong password")]
  public void WrongPassword()
  {
  }
}