1

The system I'm working on has a core web application where the bulk of the work is done. However, it relies on another server to handle transactional finance data. It connects to the server using a REST API. I'm trying to work only on the core web application but I keep hitting pages and function calls that rely on the REST API.

For getting up and running, I was told that the best option is to connect to the VPN and to point the API client to the shared REST API server.

While that's a reasonable solution for a quick bug fix or QA, I feel that it isn't very good for the application in general. This massive dependency makes it hard to test and develop but I don't know how to break it.

What are my options?

Should I be mocking out all the API client calls? Should I be using mocks and patches only when I'm fixing something? Or should I just suck it up and use the VPN and shared REST API server?

  • 1
    There's a real benefit to mocking out all the API client calls. Just think of all the automated testing you can do while you sit back. Make a change, run your tests, and verify that everything is still working properly. Ever since I mocked out a large project at work that relied heavily on a database, I've been so much more at ease making even minor changes that might have broken everything before (and silently, too). – mgw854 Jan 14 '15 at 19:13
  • @mgw854 I'm already mocking things out for unit tests, I'm mainly wondering if I should have mocks when I'm manually testing frontend-related changes. – Rudolf Olah Jan 14 '15 at 19:37
1

The two approaches I've seen are as follows:

  1. Duplicate the dependency in a Development environment.
    • This clearly requires more resources, and can be a hassle when it comes to keeping your environments in sync, but it's as representative of Production as you can get.
    • All you have to change is the endpoint of your REST API dependency.
  2. Create a dependency Mock you can use when debugging
    • This is an option I've used when it simply wasn't possible to create a Dev environment representative of Production. It will require writing a mock of your own, but, depending on the complexity of your scenarios, might not actually be much work.
    • If you like building manual testing tools, this can be a lot of fun. It also makes demos a bit more interesting!

Not much else to say, really :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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