java - Jenkins - Env Inject - Changing .properties file used in my project -


how inject environmental variables jenkins

following structure of automation.properties file of maven project (test-ng). have placed same in config folder of project workspace.

baseurl = http://uat.myportal.com/ browser   = firefox getdbversion=y  testdata = inputtestdata/inputdata.xlsx geomcheckdata = inputtestdata/geometry_check.xlsx c_testdata = inputtestdata/c_testdata.xlsm d_testdata = inputtestdata/d_testdata.xlsm 

i retrieving properties , add global variables shown below:

public void storeallconfigproptoconstants() throws exception {     fileinputstream fs = new fileinputstream("config/automation.properties");     config = new properties();     config.load(fs);      constants.url = config.getproperty("baseurl").trim();     constants.testdata = config.getproperty("testdata").trim();     constants.getdbversion= config.getproperty("getdbversion").trim();      ....      .... } 

when integrate project jenkins, couldnt change these envrionmental variables.

can 1 me in doing same. tried envinject doesnt seems working.

i have tried combination picking location not jenkins ..

i new jenkins , need experts in resolving same. need that, should able change during local execution duing jenkins execution.

explanation screenshots(if possible) me.

attaching screenshot of jenkins setup

jenkins set 1 jenkins set 2

your class reading conf/automation.properties file. file must exist in jenkins job $workspace/ directory.

env inject not replace values in file.

env inject create environment variables file if give file path (which have done). env inject create environment variables in properties content (which have done).

either change logic read environment variables instead of properties file, or provide desired properties file.


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -