Unit Testing Denial Pattern #1: Pretending the test is no longer valid

My blog has moved. You can view this post at the following address: http://www.osherove.com/blog/2008/4/30/unit-testing-denial-pattern-1-pretending-the-test-is-no-long.html
Published Wednesday, April 30, 2008 4:21 PM by RoyOsherove

Comments

Wednesday, April 30, 2008 5:23 PM by Jeremy D. Miller

# re: Unit Testing Denial Pattern #1: Pretending the test is no longer valid

Anti-pattern #2:  The unit test is written so poorly that you have no idea if it's important anymore or not.

Solution:  Get in the wayback machine and whack yourself upside the head as you write that unit test in the first place.

Wednesday, April 30, 2008 8:03 PM by Michael Hedgpeth

# re: Unit Testing Denial Pattern #1: Pretending the test is no longer valid

Could another reason you experienced this be that you had an obscure test?  See xunitpatterns.com/Obscure%20Test.html.

Wednesday, April 30, 2008 8:13 PM by RoyOsherove

# re: Unit Testing Denial Pattern #1: Pretending the test is no longer valid

An obscure test would have made it easy to disclaim as "invalid", but this test was so simple and understandable, it was an outright self-lie that I wanted to be believe it to be invalid.

Had it not been readable, the path taken could have been different - for the worse.

So, one other solution: make sure your test is *not* obscure so that the truth hits you in the face when you see it - the test is indeed valid.

Thursday, May 01, 2008 6:26 AM by ploeh blog

# Unit Testing Anti-Pattern #2: Not Covering Bugs In Your Tests With Tests

Roy just posted a unit testing anti-pattern based on his personal experience. I'd like to follow up with

Thursday, May 01, 2008 7:24 AM by Travis Laborde

# re: Unit Testing Denial Pattern #1: Pretending the test is no longer valid

Brian Donahue (http://www.persistall.com/) gave a talk last night at the PhillyNJ.NET user group (http://www.phillynj.net) about BDD and one thing that really clicked for me was the naming conventions in the tests.

Where I've had tests named like "TestCustomerFactoryReturnsACustomer" I see the effectiveness now of using a better naming convention which more closely relates to the actual business need being verified.

If I'm explaining it correctly I think I'll be ending up now with classes named like "When_Valid_Customer_Is_Requested" which might have test methods like "Should_return_Customer_Instance" and perhaps "Should_Update_Audit_Log" etc.

Given that sort of naming convention I think it will be much easier in the future to tell if a test is still valid given any new context.

Probably you already know all this, but reading your post the morning after having that talk from Brian made me just HAVE to comment :)