I DO like the granularity this template encourages. Yet I don’t like the template, or at least not the should-prefix.
True, it makes look source code like a complete sentence. But I don’t program in english or any other natural language, but in Java or any other programming languag. And in that context ‘should’ becomes just noise.
I have seen a variation of this template where the Test class name was the name of the class under test prefixed with a ‘A’. So you get stuff like: AClassUnderTest.shouldDoSomething.
This is like the super evil twin to the evil “should” because it destroys the link between the class under test and the test class
first thing first, sometimes instead of ’should…’ nameing convention I use ‘it..’ nameing convetion. For example ItLoggesUserToTheSystem.
But I understand that the problem is that you don’t like those sentences at all. Well I’m not going to convince you, for me however it is much more readable if I can read my (or someone else’s) code like I was reading a book.
What ’should..’ naming convention does is reminding you what you really want to test. If you can’t say it in one sentence, then you are testing to much.
Excellent template Paul …. i really like how well the template is organized and how easy it is to work…
thanks for taking time to blog about this…. will use this going forward
cheers,
GT
Thanks! I’m glad you enjoyed it
I DO like the granularity this template encourages. Yet I don’t like the template, or at least not the should-prefix.
True, it makes look source code like a complete sentence. But I don’t program in english or any other natural language, but in Java or any other programming languag. And in that context ‘should’ becomes just noise.
I have seen a variation of this template where the Test class name was the name of the class under test prefixed with a ‘A’. So you get stuff like: AClassUnderTest.shouldDoSomething.
This is like the super evil twin to the evil “should” because it destroys the link between the class under test and the test class
Hi Jens,
first thing first, sometimes instead of ’should…’ nameing convention I use ‘it..’ nameing convetion. For example ItLoggesUserToTheSystem.
But I understand that the problem is that you don’t like those sentences at all. Well I’m not going to convince you, for me however it is much more readable if I can read my (or someone else’s) code like I was reading a book.
What ’should..’ naming convention does is reminding you what you really want to test. If you can’t say it in one sentence, then you are testing to much.
I’m glad you liked the rest of the template.