Make the robots talk.

Your unit tests should convey more information.

It’s one thing to have a healthy suite of unit tests covering your codebase. But with hundreds if not thousands of tests in play, tracking down errors can be a little frustrating at times. To assist with debugging, your unit tests should have meaningful names that describe in plain English not only what they are testing, but which module is being tested. This way, it will be much easier to track down issues.

Unit tests should also give verbose error messages that make it immediately obvious what is wrong. The error messages can include details, context, and information about the example that failed.

Also, don’t be afraid to add comments in the test cases. It can be extremely helpful to know why certain tests and examples exist.

Leave a Reply

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

You are commenting using your 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 )

Connecting to %s

%d bloggers like this: