When I want to test including the place where the value is raised by the environment variable, I want to manage to die without the environment variable at the time of testing
write in pom
pom.xml
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>{your version}</version>
+ <configuration>
+ <environmentVariables>
+ <TEST_ENV>100</TEST_ENV>
+ </environmentVariables>
+ </configuration>
</plugin>
Now you can get 100 where you say System.getenv ("TEST_ENV ")
in your code.
https://maven.apache.org/components/surefire-archives/surefire-3.0.0-M1/maven-surefire-plugin/test-mojo.html#environmentVariables
Recommended Posts