Interested in a
Personal Demo ?


Name* :
Please Enter your Name
Company E–Mail* :
Please Enter a Valid Email

Testimonials


"Typemock has helped us get some difficult to test code under test, as well as speed up the writing of some business rules/classes. The new version is quite impressive with the suggested tests. Any tool that helps you write more (and better!) tests has got to help make better quality code." 
Stephen Price Lead Developer at Unlisted Marketplace
Success stories

PurchaseOptions


US Toll Free
866–895–4680
Outside US
+44–203–150–0293
Get your printable quote
Buy online

 

Avoid logic inside a unit test

Why? 

Unit tests that have logic can also have logic related bugs. THe worst thing you can do is to have a bug in your test since that is the hardest bug to find. It's hard to find because you usually assume your test is OK and unless you are doing true Test Driven Development, you are likely to find that bug much later in time, after you've search for the possible problem in the production code under test

also, having logic in a test can usually mean that you are testing more than one thing - in that case it is better to separate the single test into multiple different tests, each testing a different aspect of the original test. that would also make the test naming easier.

Possible types of logic inside a test may include: