getgauge / Intellij-Plugin

Gauge IntelliJ IDEA plugin
Apache License 2.0
44 stars 28 forks source link

Plugin does not detect specs in non-standard location #373

Closed ginkel closed 5 years ago

ginkel commented 5 years ago

We are using Gauge in a Maven-based Java project and put the specs in a somewhat unusual location by Gauge's standards, but in line with Maven conventions, namely src/test/specs. Gauge is configured accordingly by setting gauge_specs_dir = src/test/specs in env/defaut/default.properties.

Unfortunately, this causes the Gauge IntelliJ plugin to not correctly detect the specs, i.e., the little play buttons on the left-hand side of the editor window are unavailable and Ctrl-clicking on a step does not open the step definition.

Strangely, this can be worked around by creating a empty specs directory in the project root (and the plugin will magically start discovering the specs in src/test/specs), but I'd assume setting gauge_specs_dir would be supported by the plugin.

Expected behavior

The IntelliJ Gauge plugin detects specs located in a non-standard location if configured via default.properties.

Actual behavior

Specs are not correctly detected and Ctrl-clicking on a step does not work.

Steps to reproduce

  1. Create a Gauge Java project
  2. Change the location of the specs dir to src/test/specs by setting gauge_specs_dir in env/defaut/default.properties
  3. Create a spec in src/test/specs
  4. Observe that the little play buttons on the left-hand side of the editor and Ctrl-clicking on a step does not work
  5. Create a specs dir in the project root
  6. Magically observe the specs in src/test/specs starting to be recognized

Version information

Gauge version: 1.0.4

Plugins
-------
html-report (4.0.6)
java (0.7.1)
screenshot (0.0.1)
nehashri commented 5 years ago

Since the specs directory can be configured per environment now, we can't rely on the environment files to determine the specs directory location.

To fix this, we need to add a configuration in IntelliJ so that the user is able to change the specs directory as per their needs. The configuration should take a comma separated list of spec directories.

ginkel commented 5 years ago

Makes sense.

What do you think about initializing the defaults of the plugin's configuration for a project based upon the setting in the Gauge default environment? I think the setting read from that env would be correct in many cases and reduce the manual configuration effort for many developers. Still, it would be possible to overwrite that inferred default from the plugin settings.

nehashri commented 5 years ago

@ginkel Relying on the default environment may not work. There is no mandate in Gauge for the presence of default environment. Gauge can be run properly even if an environment by the name default is not found. If we rely on getting the settings from the default environment, we are indirectly mandating users to have an environment with this name. So I suggest not to do this. Instead have a configuration in IntelliJ where users can configure the spec directories.

trung commented 5 years ago

With the proposed fix, it seems that user needs to declare specs directories in 2 places: environment files and the plugin configuration. Not sure this is ideal.

Why not reading spec directories from all the environment files and default to specs if non is found?

gaugebot[bot] commented 5 years ago

The fix should be available in nightly >= 5-4-2019

Debashis9012 commented 5 years ago

This issue has been verified and found fixed with the below version. 0.3.15.nightly-2019-04-11