Interested in a
Personal Demo ?


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

Testimonials


"Typemock - My testing tool of choice. Each time I use it, I rediscover its power, and I'm amazed. Great tool!"
Jason Divis, @CodingOfficer
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: