Ask a Question

Dev and TST env

SOLVED
ashsharma22
Occasional Contributor

Dev and TST env

Hi All,

 

I have two end-points for TST and DEV environments separately with different API key. 

 

  1. https://api.xxxx.tst.xxxxxx.com/school/student-mapper : 123xxxAPIKEYxxxKey  (Variable Name - apiurl="", apikey="")
    https://api.xxxx.dev.xxxxxx.com/school/student-mapper : 777xxxAPIKEYxxxKey   (Variable Name - apiurl="", apikey="")

 

What is the best way to configure this in ReadyAPI in the environment variable section (with same variable name in dev/tst) and when we switch the environment - test case should work fine. 

 

2 REPLIES 2
TNeuschwanger
Community Leader

Hello ashsharma22,

 

best way is to go to environment drop down and choose "configure environments".

add a new environment for "TST" and another new environment for "DEV". 

choose the new TST environment and add custom project properties of:

   Name column: apiurl

   Value column: https://api.xxxx.tst.xxxxxx.com/school/student-mapper

   Name column: apikey

   Value column: 123xxxAPIKEYxxxKey

choose the new DEV environment and add custom project properties of:

   Name column: apiurl

   Value column: https://api.xxxx.dev.xxxxxx.com/school/student-mapper

   Name column: apikey

   Value column: 777xxxAPIKEYxxxKey

 

The result will be a project accessible property of apiurl and apikey that can be used in test cases whenever you pick TST or DEV from the environment drop down list.

 

to use those properties in a groovy script, they could be referenced like:

def apiurl = testRunner.testCase.testSuite.project.getPropertyValue("apiurl");
log.info "apiurl=" + apiurl;

def apikey = testRunner.testCase.testSuite.project.getPropertyValue("apikey");
log.info "apikey=" + apikey;

 

Regards,

Todd

Just see and look forward to it as Dev and TST env was the main title that was being given there. In case that's what you like to know about then we hope samedayessay review can be good enough for different reasons as well, so just check them out now.

cancel
Showing results for 
Search instead for 
Did you mean: