Concordion - Calling external services from test class

165 Views Asked by At

We are following modular services approach and want to write concordion test cases. So when writing a concordion for a service, we want to mock the service this service calls as the service might be down. What is the best way to do it? Should I mock the service? But then I wont be actually calling my other service.

1

There are 1 best solutions below

0
Jimmy K On

A couple of options come to mind (though always tricky to understand your context exactly).

  1. Add a configurable 'service endpoint'. Add configurable options for your mock and real service. Switch as required.

  2. If you have control of the real service, delegate the calls behind the real service, either to the mock or real service (as required). Again, using configuration.

FYI:

Seeing as you are using Concordion, you may be interested in hearing about a new Concordion project called Cubano, which also provides a helpful Cubano Demo project. The Cubano Demo project shows an example of what you might be looking for. Pull down the code from Cubano Demo and take a look. This example uses WireMock for mocking, but could easily be configured to use a real service.