I have two end-points for TST and DEV environments separately with different API key.
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.
Go to Solution.
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:
Value column: https://api.xxxx.dev.xxxxxx.com/school/student-mapper
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;
View solution in original post