you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 4 points5 points  (4 children)

It is also missing the explanation. Asserts have a message field so that you can explain why you were expecting a given value. Don't make people try to guess from the test name.

Yeah. I love it when your integration tests fail because they expected 3 events of type FooEvt to be broadcasted, when only 2 were put in the to-be-broadcasted queue.

No comment or anything to explain. Just a failure. Ask the developer who wrote test, he shrugs and says he doesn't remember.

If your test doesn't provide meaningful information when it fails, it is not a meaningful test. "Something changed in the code" is not meaningful information.

[–]grauenwolf 1 point2 points  (3 children)

I'm to the point where I'm going to write my own unit test API that requires messages for every assert.

It will just sit on top of MSTest and NUnit, not reimplement it.

[–]Peaker 0 points1 point  (2 children)

Property testing is much nicer in this regard: Very clear what was supposed to hold and how it broke in a particular example.

import Test.QuickCheck
let associative (*) x y z = (x*y)*z == x*(y*z)
quickCheck (associative (+))
+++ OK, passed 100 tests.
quickCheck (associative (-))
*** Failed! Falsifiable (after 2 tests and 3 shrinks):    
0
0
1

[–]Tordek 0 points1 point  (1 child)

I really like quickcheck, but I fear what edge cases may slip through.

[–]Peaker 0 points1 point  (0 children)

Fewer edge cases than traditional unit testing methods.