Some programmers in my team sometimes write unit tests which call the method, gets the result but forget to call the proper Assert
methods to actually check what's happening.
I was wondering if there is any configuration I can do to force MSTest to fail the test if no verification is done. I remember seeing something like this in DUnit, but could not find it in Visual Studio.
Check out Test-Lint from Roy Osherove and co. It's static code analysis for test code.
I tried it out once when it was out for public alpha/beta.. was pretty well-behaved. However didn't try out this specific need. I don't think MSTest or most unit testing frameworks will guard against this out-of-the-box.
Also aquinas has a valid comment.. Education might work better than inspection-and-the-stick. You may even be able to create a custom rule to catch rogue asserts.. Check the tool out.
From the home page of the tool,
What issues does it detect?
Currently Test Lint finds a set of common problems:
* Missing asserts in your tests
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With