maven - How to set env variable from within junit test case? -
i followed how set env variables maven run test correctly? , configured pom :
<plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-surefire-plugin</artifactid> <version>2.15</version> <configuration> <systempropertyvariables> <sendgrid_username>username</sendgrid_username> <sendgrid_password>password</sendgrid_password> </systempropertyvariables> </configuration> </plugin>
when run mvn test
command, giving following error,
error in custom provider, java.lang.illegalstateexception: sendgrid_password env variable must set.
what doing wrong ?
when doing research find answer, found out following : processbuilder can used set env processes spawned it. dont know whether processbuilder helps in case not spawning processes. project maven project , run test mvn test command.
can body explains me how set env situations (i.e., maven + junit )
i able set properties
problem how set environment variable
program expecting env variable.
if read documentation correctly, configuration use is:
<environmentvariables> <sendgrid_username>username</sendgrid_username> <sendgrid_password>password</sendgrid_password> </environmentvariables>
could issue?
source: http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#environmentvariables
Comments
Post a Comment