Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's funny, you are asking what test names have to do with quality, and you proceed with mentioning a really bad test name, 'toTryToFitTheTestDescriptionIntoItsName', and (correctly) stating that this has zero benefit.

Just like normal code, test methods should indicate what they are doing. This will help you colleague when he's trying to fix the failing test when you're not around. There are other ways of doing that of course which can be fine as well, such as describing the test case with some kind of meta data that the test framework supports.

But the problem that OP is talking about, is that many developers simply don't see the point of putting much effort into making tests readable. They won't give tests a readable name, they won't give it a readable description in metadata either.



> It's funny, you are asking what test names have to do with quality, and you proceed with mentioning a really bad test name, 'toTryToFitTheTestDescriptionIntoItsName', and (correctly) stating that this has zero benefit.

Not at all. Those kinds of names are like a de-facto standard for the people that try to push this kind of practice. Obviously the example I used is not related to any real test.

> This will help you colleague when he's trying to fix the failing test when you're not around.

Really? Encoding what a test function does in it's name is your recommendation for helping someone understand what the code is doing? There are far better ways of accomplishing this, especially when it comes to tests.

> There are other ways of doing that of course which can be fine as well

'Can be fine as well'? More like 'far superior in every possible way'.

> But the problem that OP is talking about, is that many developers simply don't see the point of putting much effort into making tests readable.

Not at all, making a test readable and trying to encode what it does into it's name are completely separate things.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: