Edit

Running a Specification

Setup
macOS
JavaScript
Visual Studio Code
Modify

Now that you successfully initialized a Gauge project with the JavaScript template, we can look at running a specification using the example specification in the test folder.

A test specification (spec) is a detailed statement of what will be tested. In Gauge, these are written in a .spec file. To learn more about how specifications work you can look at the overview section.

Running a Specification using Visual Studio Code

Step 1: Open Specification

Open the example spec. The Gauge specification file is present under /specs/example.spec

Open example.spec file

Step 2: Run Specification

Run your Gauge specs in Visual Studio Code by choosing the option to Run Spec

Visual Studio Code JavaScript run code lens

You’ll get immediate feedback in the output about what got executed.

Visual Studio Code JavaScript execution console

Running a Specification using Intellij

Step 1: Open Specification

Open the example spec. The Gauge specification file is present under /specs/example.spec

Open example.spec file

Step 2: Run Specification

Run your Gauge specs in Intellij by clicking on the Run example.spec.

IntelliJ IDEA run code lens

You’ll get immediate feedback in the output about what got executed.

IntelliJ IDEA execution console

Running a Specification using Visual Studio

Step 1: Open 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.

Step 2: Run Specification

  • 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 specification

You’ll get immediate feedback in the Text Explorer about what got executed.

Visual Studio text explorer

Now that you have successfully run a Gauge specification, you can go ahead and view the report from VS code.