1

The setup

So we have a RESTful JSON API. There are iOS and Android applications that consume the said API (one of each).

The code for the applications is such that the endpoints are hardcoded to "http://api.mycompanyname.com/json/someEndpoint".

In order to test the applications our sysadmins have setup DNS poisoning on our local WiFi, so if a request is sent to "http://api.mycompanyname.com" from within our local WiFi it gets redirected to our testing API server, and then depending on the server configuration a specific vhost on that server processes those API requests.

Problem is that we need to test several tasks in a parallel, and the above described process requires serial testing since you have to change the server configuration if you want to switch which vhost does processing.

The question

What is the best way to implement parallel testing for our applications?

Additional information

We use scrum, and although we have 5 PHP programmers that work on API development (besides other unrelated programming tasks) the iOS and Android development is done externally. Testing is done inhouse. Multiple independent features can be in development in a single sprint. Applications are very complex (according to our external partners).

2 Answers 2

2

Change the hardcoded endpoint so it can be changed. Read the endpoint from a file containing all your settings. Its pretty easy to do, and allows for other settings to be changed according to other parameters.

Possibly the easiest thing for you to do is to read the file if it is present, or default to a fixed value if not - this allows you to drop a new file in containing different settings, and still keep the defaults if you deploy just the app and ignore the settings file in production.

2
  • My team is looking for something simpler, that doesn't require rewriting the applications. As in they want to leave the "api.mycompanyname.com" hardcoded. But the file thing is indeed simpler than my dev mode switch.
    – Shinhan
    Commented Jun 21, 2016 at 11:42
  • lazy devs you mean,who would rather put a huge amount of effort breaking the way the DNS works on your admin team. If I was the admins, I'd set up a separate network for the dev team and disconnect it from the internet until they fix their app to be able to run against an arbitrary endpoint! After all, the dev team could run their own DNS server and not break the real network :-)
    – gbjbaanb
    Commented Jun 21, 2016 at 11:53
0

I gotta admit that I already have one suggestion and I'm posting this question to see if anybody has a better idea.

  1. Rewrite the applications so endpoints are not fixed, and the base API URL is defined in a single property with the default value being "http://api.mycompanyname.com"

  2. Implement a "dev mode" property in applications. If this property is turned on then the user is shown the option to type in a different base API URL. This way each mobile device can be used to test a different task, since each task will have a separate vhost on our API testing server.

  3. If a user accesses our API using local WiFi use the above mentioned DNS poisoning to redirect him to a local API server that will then send a special parameter that will inform the application to turn on the dev mode.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.