getgauge / Intellij-Plugin

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

An exception thrown when there's a substituted env var in env properties #354

Closed haroon-sheikh closed 6 years ago

haroon-sheikh commented 6 years ago

Plugin throws an exception when there's a substituted env var in env properties.

Expected behaviour

Gauge plugin tried to load the env var before running the tests. It should only throw the error on running the spec.

Actual behaviour

'ENV_VARIABLE' env variable was not set.%!(EXTRA []interface {}=[])

Error ----------------------------------

'ENV_VARIABLE' env variable was not set.

Get Support ----------------------------
    Docs:          https://docs.gauge.org
    Bugs:          https://github.com/getgauge/gauge/issues
    Chat:          https://gitter.im/getgauge/chat

Your Environment Information -----------
    darwin, 1.0.1
    flash (0.0.1), html-report (4.0.5), java (0.6.8), js (2.3.1), screenshot (0.0.1), spectacle (0.1.3), xml-report (0.2.0)

Steps to reproduce

  1. Add property=${ENV_VARIABLE}
  2. Import the project
  3. You should see the exception thrown

Version information

Gauge version: 1.0.1

Plugins
-------
flash (0.0.1)
html-report (4.0.5)
java (0.6.8)
js (2.3.1)
screenshot (0.0.1)
spectacle (0.1.3)
xml-report (0.2.0)
nehashri commented 6 years ago

@haroon-sheikh Gauge expects all environment variables to be available while running the project. It needs to read the variables in the properties files for while starting the IntelliJ plugin too. This is the expected behaviour.

haroon-sheikh commented 6 years ago

Can we some how catch the exception? The problem is IntelliJ needs restarting once you add the env variables.

nehashri commented 6 years ago

I don't think that is possible. Its Gauge core that errors out, this is run as a child process of IntelliJ. So catching exceptions is not easy here.