Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.