Unit-testing – How to test configuration changes in a service

continuous integrationcontinuous-deliverytestingunit testing

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.

Best Answer

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.

Related Topic