vendredi 20 mai 2016

Integration testing support classes

Building an integration test suite in a Java / Maven project. In this particular case, I need several supporting classes, to achieve significant code reuse. They will end up relatively complex and I'd like to test them too. I'm thinking there are these possible locations:

  • Beside the production code
  • Beside the other testing code
  • In a third place or even a separate module

All have prons and cons from my perspective:

  • Beside the production code
    • Testing-related code should not be placed there
    • If placed there, tests of these supporting classes will follow the usual src/main [code] -> src/test [test] pattern
  • Beside the other testing code
    • It's natural to place testing-related code in src/test
    • It's unnatural to test tests
    • Tests would be in the same place as code
  • In a third place, as it's neither testing nor production code
    • For a handful of classes, not sure if it's worth the trouble
  • In a third place or even a separate module
    • It might bring additional clarity to what's going on
    • It will separate concerns
    • Additional module will bring overhead that is likely not justified for a few classes

If you ran into similar situations, where did you put these and why?

Aucun commentaire:

Enregistrer un commentaire