Can I ensure all tests contain an assertion in test/unit?
Posted
by Andrew Grimm
on Stack Overflow
See other posts from Stack Overflow
or by Andrew Grimm
Published on 2010-06-11T02:42:25Z
Indexed on
2010/06/11
2:53 UTC
Read the original article
Hit count: 329
With test/unit, and minitest, is it possible to fail any test that doesn't contain an assertion, or would monkey-patching be required (for example, checking if the assertion count increased after each test was executed)?
Background: I shouldn't write unit tests without assertions - at a minimum, I should use assert_nothing_raised
if I'm smoke testing to indicate that I'm smoke testing.
Usually I write tests that fail first, but I'm writing some regression tests. Alternatively, I could supply an incorrect expected value to see if the test is comparing the expected and actual value.
© Stack Overflow or respective owner