How to change resource path for different environments.
Following is my scenario: Using Ready API.
I'm working with different environments ( dev, test & staging) the requirement here is utilizing the same test scenario for different environments.
According to my project, the resource path is differ based on the environment.
For example for dev environment: http://dev.company.com /rs/hotel/V1/shopping the resource path is different for test environment example: http://test.company.com /APINH0I/V1/shopping
I can able to change the endpoint http://test.company.com to http://dev.company.com when I chose the environment option from the ready api tool. Changing the resource path going in the project is effecting all the resources, with this I can't able to execute the same scenario for two different environments. ( don't want' to duplicate the test suite, it will be huge for maintenance).
Could you please recommend or suggest any workaround to handle this scenario.
First of all, I presume you are using the top set of lines. I see that the magic number 24 is used. That is longer than the length of your API (in bytes). That will make it not work.
there are 22 characters in "http://dev.company.com" and 23 characters in the "http://test.company.com" in your original post. In my response to you there is a link to a solution I made to someone else told that person to figure out the byte length.
My suggestion is change 24 to 22 and just test for now in the dev environment.
Then change 22 to 23 and use the test environment.
The line below is something to ignore "//" is a comment. It's java-like, C++-like
//String resourcepath = new String(therequestUri.substring(beginindex, endindex))
As for the output I see
/rail/rs/V1/tsearches and
/rail/sohail/V1/tsearches
It looks as though somehow it sees two resource paths. Possibly to do with using the wrong number on the API size.
Take small steps. Test with one environment and one resource path.