8

What is the best approach to testing a service when you add a new configuration? For example my service offers a service to a customer and based on the customer configuration, it will offer a different type of service. E.g. if the customer selects a particular currency they are offered a 20% discount compared to another currency.

The example above does not matter. What matters is the approach people are taken when doing CI\CD

The logic for working out the discount is in the domain and has unit tests around it. My question is if you have merchants configured with different rules to figure out the discount (all based of configuration and the domain works it out), then if a request comes in to change the configuration how do you verify it?

  1. Do you write more tests?
  2. Do you not test as already in unit tests?
  3. Manually test changes?
  4. Other

I have read xUnit Test Patterns and Test-Driven Development books along with many articles but have not come across how people manage this (configuration changes within service and verifying correctness).

I don't see this addressed in continuous delivery book either.

migrated from stackoverflow.com Nov 25 '16 at 16:53

This question came from our site for professional and enthusiast programmers.

1

Your business logic is already tested by unit tests. Can you test it with different configuration parameters easily? If not, you should separate those two :

Config <- App -> Business Logic

Here for example your application takes care of reading the configuration, and just calls the business logic with parameters. Easy to unit test this way.

In integration tests, you test that the whole system works together, not the business logic.

0

Create a new integration test that has the required conditions and a testable result.

One part of the test setup should be the currency configuration where you can have the currency set and thus test specific discounts.

Your Answer

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