1

I'm using IntelliJ IDEA to write and run e2e tests with JUnit. My tests require some environment variables to be set, so I set these in the Run Configurations dialog (through Run-->Edit Configurations, Environment Variables field).

This works fine, but the problem is whenever I run a single test (e.g. by clicking the green "play" icon to the left of the code editor), it creates a new run configuration for me to run this single test without the environment variables I defined, which obviously causes it to fail. I need to open the Run Configurations dialog again and copy the environment variables from another configuration to the new one. Note that I need to do it for every single test that I run, which is very annoying.

Is there a way to set the environment variables only once and use them for every test that I run? Environment variables setting in the Run Configurations dialog

Arnon Axelrod
  • 1,444
  • 2
  • 13
  • 21

1 Answers1

2

You can expad the "Defaults" in the list to the left, pick JUnit and then set the env variables there. This config will then get copied to whatever new configurations are created afterwards:

Intellij Default->JUnit

mszymborski
  • 1,615
  • 1
  • 20
  • 28