Putting them together is AMAZING. So when I used to do Java development I thought the organization was great but every time I had to find a unit test I had to dig through a folder structure.
Then I tried GO. GO puts them together. I was amazed at how such a simple concept could keep my code so much better organized. I could immediately open both the code and the unit tests for said code. Just don't put a ton of files in any one directory (if you have a lot of files in a directory you're actively coding it I'd argue your file structure is not optimal).
Now when I do JavaScript development I have adopted 3 extensions:
- .aspec.js is for unit tests that should work in all environments
- .nspec.js is for unit tests that only work in node.js
- .cspec.js is for unit tests that only work on a client like a web browser
Then I tried GO. GO puts them together. I was amazed at how such a simple concept could keep my code so much better organized. I could immediately open both the code and the unit tests for said code. Just don't put a ton of files in any one directory (if you have a lot of files in a directory you're actively coding it I'd argue your file structure is not optimal).
Now when I do JavaScript development I have adopted 3 extensions:
- .aspec.js is for unit tests that should work in all environments
- .nspec.js is for unit tests that only work in node.js
- .cspec.js is for unit tests that only work on a client like a web browser
If you're board you can poke at some of my open source projects that use this pattern https://github.com/KrisSiegel/msngr.js