I’ve read a lot about TDD and code smells. Up to this point I have found almost nothing on smells in the tests thou. This lead me to do some thinking.

I must admit that when I first started doing TDD, I really didn’t get it. I wasn’t doing TDD really. I thought I was but I was actually writing unit tests _after_ writing my code. It took some time until the TDD process really sank in. This is not very unusual I’ve discovered.

So, one of the biggest problems with TDD is to spot design _issues_ early. At least it is to me. If you’re like me you spend most of your time writing tests or thinking of good tests. After some discussions with a few collegues I’ve come up with a few smells. I’m not sure what they point at but I know for sure they make testing hard. And when I get rid of them the design usually gets a lot simpler, easier. To keep it short, better.

Here are the smells:
– Hard to name test classes
– Hard to name test methods
– Large fixture/set up
– Lists that are sent back and forth into classes
– No asserts

I’ll have to discuss more bad smells and figure out what the ones I’ve already discovered means. And if they need clarification.

Advertisements

About Ola Ellnestam

Agile Coach, Systems developer, Agile Practitioner and father of three.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s