I have a concern with "honesty" of test when doing TDD. TDD is
- Write red test
- Write just enough code to make it green
- Refactor and let the test green
So far so good. Now here is an example of applying the principle above, such kind of example were already met in tutorial & real life :
I want to check that the current user email is displayed on the default page of my webapp.
- Write a red test : "example@user.com" is displayed inside default_page.html
- Write just enough code to make it green : hardcode "example@user.com" inside default_page.html
- Refactor by implementing get_current_user(), some other code in some others layers etc, letting the test green.
I'm "shocked" by step 2. There is something wrong here : the test is green even if nothing is actually working. There a test smell here, it means that maybe at some point someone could break the production code without breaking the test suite.
What I am missing here ?