All Projects → getgauge → Intellij-Plugin

getgauge / Intellij-Plugin

Licence: Apache-2.0 license
Gauge IntelliJ IDEA plugin

Programming Languages

java
68154 projects - #9 most used programming language
CSS
56736 projects
Lex
420 projects

Intellij support for Gauge project.

Actions Status Contributor Covenant

NOTICE

This repository is archived

All development and releases are now made from https://github.com/JetBrains/intellij-plugins/tree/master/gauge If you have any issues with the plugin please report it at https://youtrack.jetbrains.com/issues/IDEA


Building from Source

> git clone [email protected]:getgauge/Intellij-Plugin.git
> cd Intellij-Plugin
> ./gradlew buildPlugin

The plugin zip will be available at build/distributions. Install the zip file from IntelliJ IDEA

Installation

Plugin can be installed by downloading from Jetbrains plugin repository.

Steps to install Gauge Intellij IDEA plugin from IDE:

  • Open the Settings dialog (e.g. ⌘ Comma).

  • In the left-hand pane, select Plugins.

  • On the Plugins page that opens in the right-hand part of the dialog, click the Install JetBrains plugin or the Browse repositories button.

  • In the dialog that opens, search for Gauge. Right-click on Gauge and select Download and Install.

    Create New Project preview
  • Confirm your intention to download and install the selected plugin.

  • Click Close.

  • Click OK in the Settings dialog and restart IntelliJ IDEA for the changes to take effect.

Note: The plugin you have installed is automatically enabled. When necessary, you can disable it as described in Enabling and Disabling plugins.

To install plugin by downloading it manually or to update plugin, follow the steps here.

Create a new Gauge project and start writing your tests.

Explore all the features of Gauge Intellij IDEA plugin now!

Creating a Java project

  • File -> New Project.
  • Choose 'Gauge'
  • Choose the project location and java sdk
  • Finish

Note: If gauge-java is not installed, it will download it for the first time.

java project creation

Maven project using gauge-maven-plugin

  • File -> New Project

  • Choose Maven

  • Select Create from Archetype

  • Select the gauge archetype - com.thoughtworks.gauge.maven

  • If the com.thoughtworks.gauge.maven archetype is not added select Add Archetype

maven add archetype

maven add archetype

  • Enter the groupId and artifactId for your project.
  • Enter Project Name and finish
  • The project will be created in batch mode, watch the console for progress.
  • After project creation close and re-open the project to enable auto-complete features.
  • Enable auto-import for the project. Under File > Settings > Maven > Importing, mark the checkbox Import Maven projects automatically.

See gauge-maven-plugin for more details on using the gauge maven plugin.

Features

Syntax Highlighting

Specifications, Scenarios, Steps and Tags are highlighted. Steps with missing implementation are also highlighted.

syntax highlighting

Auto Completion

Steps present in the current project can be listed by invoking the auto completion pop up ctrl+space after the '*'.

step completion

Quick fix

step quick fix

Navigation

Usage: right Click -> Go to -> Declaration

Formatting

A specification file can be formatted easily using the keyboard shortcut of Spec Format in the action menu ctrl+shift+a.

This formats the specification including indentation of tables and steps.

Execution

  • Specs can be executed by right click -> Run spec.
  • Execute all specs inside a directory by right click -> Run specifications

Single Scenario Execution

A single scenario can be executed by doing a right click on the scenario which should be executed and choosing the scenario. right click -> run -> Scenario Name

.. note:: If the right click is done in context other than that of scenario, by default, first scenario will be executed.

scenario execution

Parallel Execution

To run multiple specifications in parallel

  • Right click on the specs directory and select Create Specifications option.
  • In the new Run configuration select In Parallel options. This will distribute specs execution based on number of cores the machine has.
  • You can also specify the Number of parallel execution streams.

Select parallel nodes based on current systems performance. For example on a 2 core machine select upto 4 parallel streams. A very large number may affect performance.

  • Select ok. Now you can run this new configuration for parallel execution of specs.

Debugging

Debugging can be performed the same way spec execution works.

  • Right click on a specification or specs directory -> Debug. Execution will halt on marked breakpoints.

Run Configuration

You can edit the run configuration to make changes to:

- The scenario or spec file to be executed
- Choose table-rows to be executed
- The environment to run against
- Add a tag filter to the execution
- Choose the number of parallel streams
- Add program arguments (Example: --log-level)

run configuration

Multiple Spec Files Execution

To execute multiple specs/scenarios add || seperated list of spec/scenarios in Specification to execute section

multiple spec run configuration

The delimiter for multiple spec files in run config has been changed from comma (,) to double bar (||). Until v0.1.0 of IntelliJ plugin, the delimiter is ,. Any higher version will have delimiter ||.

Rephrase Steps

  • right click -> Refactor -> Rename on a step to rephrase it.
  • The parameters will be in < > in the rephrase dialog. They can 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 -> Find Usages on step/concept to see the usages.

find usages

Extract Concept

  • In the editor, select the steps to be transformed into a concept.

  • On the main menu or on the context menu of the selection, choose Refactor | Extract to Concept or press ⌥⌘C.

  • In the Extract Concept dialog box that opens

    • Specify the concept name with parameters to be passed from the usage. Example: Say "hello" to "gauge".
    • Select the file name from the spec file dropdown list or specify the new file name/path relative to the project.
    • Click OK.
  • The selected steps will be replaced with the specified concept name. extract to concept

The intellij idea gauge plugin comes with more features to simplify writing specifications.

Create Spec and Concept files

  • You can right-click in under any directory in the specs directory and create a new specification or concept file. They will be created with a template to get you started.

Spec creation

Templates

  • To easily create markdown tables in specification(.spec) or concept(.cpt) files you can use predefined table templates specifying the number of columns needed.

For example, to create a table with 4 columns type

table template fill

Then fill the column names in the template.

table template fill

  • To write the specification heading in markdown, you can use the predefined heading template.

spec heading enter

Then fill the specification name in the template.

spec heading fill

  • Scenario heading in markdown can be easily written using the predefined scenario heading template.

scenario heading enter

Then fill the scenario name in the template.

sce heading fill

HTML Preview

  • A specification file, written in markdown can be viewed as HTML in browser.

This is a spec file in markdown.

spec text

Press alt + F2 or right click and select open in Browser option. It gives option to choose a browser. On choosig a browser, it opens a browser window with HTML equivalent preview of spec file.

browser preview Since specs are written in markdown, they can be converted to HTML using any markdown to HTML convertors.

License

Apache License, Version 2.0

Copyright

Copyright (c) ThoughtWorks, Inc.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].