I have started to separate my unit tests from my integration tests by using Maven Surefire and Failsafe.

Now I'm wondering what good ways there are to deal with separate environments. Take for example these two integration tests scenarios:

  • Given a customer id, can I get a list of orders belonging to that customer.
  • Given a customer id and a product id, can I create an order for that customer.

I want to be able to run these tests against both TEST and PRODUCTION environments, but they will need different data and in some cases slightly different code as well. In some cases there are also tests I might not want to run in PRODUCTION, but only in TEST.

For example my test customer won't have the same id in both TEST and PRODUCTION. And when I need to create the product for the order I might need to instantiate a different product (with different properties, etc).

What are some good ways of tackling this without too much of a mess or duplicated code?

  • have you come up with anything yet? – t3chb0t Jun 24 '16 at 18:21

Your Answer

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

Browse other questions tagged or ask your own question.