cancel
Showing results for 
Search instead for 
Did you mean: 

Dev and TST env

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. 

 

1 REPLY 1
TNeuschwanger
Contributor

Re: Dev and TST env

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

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors