as

Friday 8 May 2015

Gauge with C#.Net - BDD Testing

What is Gauge?
Gauge is an open source BDD test automation framework. Gauge is used to write test specifications in business user language (Gherkin) that is very easy to learn and understand. Writing the test specifications does require you to be expert in any of the testing tools. You can write tests in simple notepad.

Features offered by Gauge.
Here is the list of features offered by Gauge.

  1. Supports multiple languages like Java, .Net, Ruby.
  2. We can execute multiple test specifications simultaneously.
  3. Plugins are available for popular IDEs like Visual Studio and IntelliJ IDEA.
  4. Finally it is free to use. 

Installation and Integration of Gauge in Visual Studio.
Now let us see how to install Gauge in Visual Studio. Before you start installing Gauge package and extension, please create a class library project in Visual Studio.


You need to follow 3 steps as mentioned below to get started with Gauge in Visual Studio.

  1. Download and Install Gauge for your operating system. 
  2. Install the Gauge.VisualStudio extension for Visual Studio. To do this, Open Visual Studio Extension Manager - Tools -> Extensions and Updates. Then Search for Gauge.VisualStudio online and install.
  3. Finally install  "Gauge.CSharp.Lib" Nuget reference. You can do this using the Nuget Package Manager which can be opened by right clicking on your visual studio project that you created earlier.


Writing Test specification using Gauge in C#.Net
When you install the Nuget reference, default gauge folder structure is created for you with one specification file having 2 scenarios.



Here is the sample specification file scenario.


Scenario contains the multiple steps. Each step is mapped to the method in the class. For example, in above test scenario, we have a step 

*say "hello" to "sagar"

This step is implemented in the class as shown below. Parameters are denoted using bracket < > symbols.


Running test scenarios in Test specification using Gauge in C#.Net
You can run test scenarios in Test specification file using Test Explorer under Test menu.
Once you open, Test explorer as shown in below image, you can run all tests or run individual scenarios by right clicking on them.
By default, there are 2 scenarios with names "First Scenario" and "Second Scenario for the specification".
I have added new scenario with name Login Scenario.

To view the output of the test execution, you can click on output link at the bottom of test explorer.
Below image shows the sample output of the test scenario execution.


Well this is just the trailer of what Gauge can do for you. There is a lot more to explore. Moreover, you can hook tests created by any tools like selenium or coded UI to Gauge easily using specifications.  Watch out this space for more on that. Happy testing.

What do you think on this topic? Please express your opinion or ask any question through comment below. You can write to me at reply2sagar@gmail.com

No comments:

Post a Comment

Leave your valuable feedback. Your thoughts do matter to us.

Sponsored Links

Popular Posts

Comments

ShareThis