views:

33

answers:

2

Is there even a standard convention for this? I see a lot of different and perhaps misguided package naming that is very mixed in some projects and thus is never consistent:

Let's say I want to write unit tests for something that falls under the 'stuff' package.

 com.company.product.amodule.submodule.stuff

The unit test could be one of these possibilities (or even somewhere between):

  • com.company.test.product.amodule.submodule.stuff
  • com.company.product.amodule.submodule.stuff.test
+3  A: 

I tend to keep the tests in the same namespace/package as the code it's testing, but in a different project.

Rich
This is helpful partly because it allows the tests to access package-protected code.
Andy Thomas-Cramer
+2  A: 

Have it inside the same namespace (package). I like maven convention to separate source folders

src root-folders:

  • production code: src/main/...
  • test code: src/test/...

You can map this to your own build-system

manuel aldana