blog comments 0 del.icio.us bookmarks 0 diggs 0 Google results 0

1.0
PostRank

An example of bad test, part 1

From Ayende @ Blog, 3 months ago, 0 views

Let us take a look at this test. When I saw it, the test cried out in pain to me: "Help me, I am so overworked."

image

This test is doing far too much. I drew the battle line on the test, just to give you a clear indication on what is going on.

image

What we are asserting are things that have nothing to do with what the test is supposed to test.This is also the classic "A test should have a single assertion" example, I think.

The test pass by side effect. It will actually be a problem down the line.

comments

No comments yet.

You must be logged in to add your own comment.