Forum Discussion

ashsharma22's avatar
ashsharma22
Occasional Contributor
4 years ago

Dev and TST env

Hi All,   I have two end-points for TST and DEV environments separately with different API key.    https://api.xxxx.tst.xxxxxx.com/school/student-mapper : 123xxxAPIKEYxxxKey  (Variable Name - ap...
  • TNeuschwanger's avatar
    4 years ago

    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