“There is no rule for what a ‘unit’ is”

When learning about Unit Testing, it was repeatedly pointed out that there is no way of objectively deciding what makes up a unit. As I thought about, it hit me: does it really matter?

Sure there is no golden rule but isn’t a unit test a unit test because of its purpose, that is to test code in its isolation? As soon as you stretch beyond and try to test components together it’s integration testing, further than that, system testing. Can it be that the purpose defines the test or is that simply a naive way to look at it?

Perhaps it is more challenging than I expect to choose the boundaries for a unit. Time will tell.

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 )

Facebook photo

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

Connecting to %s