Search The Blog
About this site

@RoyOsherove

Subscribe!

This site aims to connect all the dots of my online activities - from tools, books blogs and twitter accounts, to upcoming conferences, engagements and user group talks.

from 5whys.com
Twitter: @RoyOsherove
My Book: The Art of Unit Testing
Latest Posts
« Poll: Which mocking\isolation framework do you use? | Main | Steal My Book »
Monday
Sep282009

Unit Test Definition 2.0

Update: added the difference from integration tests at the end of the post.

 

Here’s my latest definition of what a unit test is:

A unit test is a fast, in-memory, consistent, automated and repeatable test of a functional unit-of-work in the system.

A unit of work is any functional scenario in the system that contains logic. it can be as short as a function, or it can span multiple classes and functions, and it provides internal or business value to the system under test.

 

how is it different that an integration test?

An integration test usually is not in-memory: it may touch the disk file system, databases, registry or other shared resources.  It may read or need a configuration file of the file system, wheas a unit test can be fully configured in-memory, for example.

An integration test will usually run much slower because it does not run in-memory.

An integration test can be less consistent – it may use threads or random number generators so that the result of the test is not always consistent.

PrintView Printer Friendly Version

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>