Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
have you come up with anything yet? – t3chb0t Jun 24 at 18:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.