Some years ago, i saw some frameworks like Ruby on Rails trying to put
tests folder in the same folder with dev codebase.
What's wrong with this approach ?
- Gemfile is becoming a mess with testing , dev and production dependencies.
- Discourage dependencies de-coupling, which means we're encourage to put everthing in the same place for the ease of "directory traversing"
- The codebase now is easier to "break", because for some reason, both tests code and dev code live in the same place, so they must please each other.
The main disadvantage with this approach, is that: Testers are afraid to write tests ! They're touching the main codebase!
I see the same problem with many frameworks in other languages also.
"Stop putting tests folder in the same codebase with dev folder"
So what does "First class testing" mean ?
Treat your tests folder the same role as dev folder, with its own dependencies, team ownership, development (tests is code), deployment (tests is code, so it could be compiled for deployment)
I'm happy with this approach and i found testing is easier to verify some weird behaviour in the main codebase.
What's your favorite testing strategy ?
Edit: My project structure: