Permalink
Fetching contributors…
Cannot retrieve contributors at this time
190 lines (113 sloc) 6.5 KB

Gauge.VisualStudio

Visual Studio plugin for Gauge - wires up Visual Studio features to Gauge.

Build status

Download Nightly

Installation

  • Open Visual Studio Extension Manager from Tools -> Extensions and Updates.
  • Go to Visual Studio Gallery and search for Gauge VS2013.
  • Click on Download and select Install option.
  • Restart Visual Studio in order for the changes to take effect.

The extension resides on the Visual Studio Marketplace

install plugin

Creating a new Gauge Project

Install project and item templates from Visual Studio Marketplace

Create Gauge Project

  • Go to File -> New Project.
  • Choose Gauge Test Project under Visual C# Test category.

ProjectCreation

  • Choose the Project location and Project Name.
  • Click OK.

This should setup a new Gauge project, and add the required meta data for Gauge to execute this project.

Alternately, you can create a Gauge project from command-line as:

    mkdir <project_name>
    cd <project_name>
    gauge init csharp

This creates <project_name>.sln file which can be opened with Visual Studio.

Syntax Highlighting

Gauge specs are in Markdown syntax. This plugin highlights Specifications, Scenarios, Steps and Tags.

Steps with missing implementation are also highlighted.

syntax highlighting

Auto Completion

This plugin hooks into VisualStudio Intellisense, and brings in autocompletion of Step text. The step texts brought in is a union of steps already defined, concepts defined, and step text from implementation.

Hint: Hit Ctrl + Space to bring up the Intellisense menu.

Auto Complete

Implement Step

If you have an unimplemented step in the spec file, it will be get highlighted with a red underline. Hover over towards the end of step text to get the Smart Tag to implement it. On clicking the Smart Tag a pop up opens. The destination of the implementation can be chosen, either a new class or from a list of existing classes. It will then generate the step with required annotation and parameters.

step quick fix

Navigation

Jump from Step text to it's implementation.

Usage: Right Click -> Go to Declaration or hit F12

Formatting

A specification file can be formatted easily using Right Click -> Format File Or use the command: Ctrl+K, Ctrl+D

This formats the specification including indentation of tables and steps.

Execution with Test Explorer

note: Refer MSDN Documentation on Unit Test Explorer` for all features of Unit Test Explorer.

When you build the test project, all the test scenarios appear in Test Explorer. If Test Explorer is not visible, choose Test on the Visual Studio menu, choose Windows, and then choose Test Explorer.

Test Explorer

Run tests

  • To run all the scenarios in a solution, choose Run All.
  • To run all the scenarios of a specification, choose Run... and then choose the group on the menu.
  • To run one or more scenarios, select the individual scenarios that you want to run, open the context menu for a selected scenario and then choose Run Selected Tests.

Run tests in parallel

If individual scenarios have no dependencies that prevent them from being run in any order, turn on parallel test execution with the |ute_parallel| toggle button on the toolbar.

If you want to use the parallel run of Gauge refer the command line parallel execution.

Test results

The pass/fail bar at the top of the Test Explorer window is animated as the scenarios run. At the conclusion of the run, the pass/fail bar turns green if all tests passed or turns red if any test failed.

As you run, write, and rerun your tests, Test Explorer displays the results in default groups of Failed Tests, Passed Tests, Skipped Tests and Not Run Tests. You can change the way Test Explorer groups your tests. You can perform much of the work of finding, organizing and running tests from the Test Explorer toolbar.

Test Explorer options

Traits

Groups of scenarios by specification, tags that are defined.

Search and filter the test list

This Test Explorer feature can be used as mentioned in Search and filter the test list of Visual Studio documentation.

Debugging

Debugging can be performed the same way spec execution works.

Right click -> Debug Selected Tests on a scenario(s) in the Test explorer. Execution will halt on marked breakpoints.

Rephrase Steps

  • right click -> Rename on a step to rephrase it.
  • The parameters can also be reordered,removed or new parameters can be added.
  • The rephrase change will reflect across all the specs in the project.

Find Usages

  • Right click on a step -> Find All References

Create Spec and Concept files

  • You can right-click on specs directory or any nested directory, choose Add -> New Item -> Go to Gauge under Visual C# Items.
  • Choose Specification or Concept file type.
  • Enter file name and click Add.

Create FileType

Development Environment Setup

  • Use BoxStarter to setup Windows box.
    • Install Windows
    • Hit http://bit.ly/20pMrXY from Internet Explorer/Edge.
    • Install Visual Studio and Resharper separately (You could consider installing from an ISO).

License

Gauge.VisualStudio is released under Apache License 2.0

Copyright

Copyright - 2014, 2015 ThoughtWorks Inc.