Test descriptions/name, say what the test is? or what it means when it fails?

Posted by xenoterracide on Programmers See other posts from Programmers or by xenoterracide
Published on 2011-01-04T15:25:57Z Indexed on 2011/01/04 15:59 UTC
Read the original article Hit count: 277

The API docs for Test::More::ok is

ok($got eq $expected, $test_name);

right now in one of my apps I have $test_name print what the test is testing. So for example in one of my tests I have set this to 'filename exists'. What I realized after I got a bug report recently, and realized that the only time I ever see this message is when the test is failing, if the test is failing that means the file doesn't exist.

In your opinion, do you think these $test_name's should say what the test means if successful? what it means if it failed? or do you think it should say something else? please explain why?

© Programmers or respective owner

Related posts about naming-conventions

Related posts about opinion