Automated testing of web applications with complex web service integration points

I’m currently on a project which has a testing problem. The problem is it has a complex web application with multiple web service integration points, some of which are sometimes flaky, have complex dataloads or difficult to setup. This means that our automated web tests (done in Selenium) can be slow, unreliable and tricky to setup (requiring automating setup steps as well as the tests themselves).

Some of those are problems which need to be solved in the service dependencies and can’t be ignored as part of proper integration tests, but at the same time it would be good to be able to quickly test the web UI aspect in isolation for Javascript components (using AngularJS) and browser compatibility without having these separate integration tests wrecking entire test runs.

To achieve this I would like to create a simple web application that mocks and mimics various services, allowing the automated tests to setup canned responses from the services, similar to how a mocked service would be used in a unit test. Basically before an automated test executes it would post one or more canned responses which would go into a stack on the mimicking  service, then as the automated test executes it’s steps should cause requests to fire against the mimic service which will respond from it’s response stack (FIFO). Responses could be added to various queues to mimic different endpoints, resources or services.

Objectives for mimic application:

  • Simple, must be easy to write a canned response or series of responses for tests
  • Fast, if it can’t respond significantly faster than the real integration points theres no advantage
  • Flexible, to handle mocking different types of services
  • Handle multiple endpoints, so you don’t need to host multiple versions for different services

Disadvantages of this approach:

  • Adds complexity to web tests (hopefully balanced out by removing more setup code)
  • Won’t catch regression issues from integration point changes
  • Need to maintain canned responses in tests

Will update when I have some simple code ready on Github.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s