Where should I put my JUnit tests?

前端 未结 4 625
抹茶落季
抹茶落季 2020-12-13 03:40

I\'ve got 2 questions about organising Unit tests.

  1. Do I have to put test to the same package as tested class, or can I organise tests in different packages?<

4条回答
  •  生来不讨喜
    2020-12-13 04:11

    Test classes should be rather in different packages, it's easier to separate them from the production code when you package it for release. I usually keep lots of test fluff in those packages, all sorts of mocks, configurations, scenarios.. But when you build - it doesn't get it. In some situations, it's a good idea to keep your testing stuff even in different projects. Depends.

提交回复
热议问题