Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set up environment variables for Gradle Runner and JUnit tests on Intellij Idea

If you use Maven or JUnit it's easy to setup the environment variables used when you run your test classes.

enter image description here

But with Gradle there is not option available. I want to avoid to configure these environment variables where I use to program, because this is not handy once I work with several apps that sometimes have similar env variable names.

enter image description here

Is this a Gradle plugin problem? How are you solving this?

like image 634
John John Pichler Avatar asked Mar 12 '23 15:03

John John Pichler


1 Answers

In your gradle build file you can easily specify which environment variables should be set when running the tests by configuring the test task with test { environment 'VARIABLE', 'value' } or similar. I do not have it 100% in mind right now.

like image 129
Vampire Avatar answered Apr 27 '23 00:04

Vampire