The two obvious places I can think of would be some sort of "testing" folder right next to the code I'm working on. So something like:
\project-code
\my-feature
\production-code
\testing
***my tests***
\co-workers-feature
\production-code
\testing
Or I could split out the testing code a completely separate hierarchy. So something like:
\project-code
\my-feature
\co-workers-feature
\testing-project-code
\my-feature
***my tests***
\co-workers-feature
I've seen a lot of frameworks use the second approach, but recently we've been putting our testing code within the production code mostly for convenience. Is one approach much better than the other or is there a best practice here?
I use the second option. That means I can ship the code without the tests if needed. Also from looking at the class or package I know where the unit tests for it are.
Here's a related question:
Do you put unit tests in same project or another project?