---
title: "Unit Test Definition 2.0"
url: "https://osherove.com/blog/2009/9/28/unit-test-definition-20.md"
canonical: "https://osherove.com/blog/2009/9/28/unit-test-definition-20.html"
published: "2009-09-28T09:26:37"
updated: "2009-09-28T09:26:37"
tags: ["Agile", "Unit Testing"]
author: "Roy Osherove"
description: "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…"
usage: "Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page)."
license: "https://creativecommons.org/licenses/by/4.0/"
---

# Unit Test Definition 2.0

By Roy Osherove September 28, 2009 In [Agile](https://osherove.com/blog/category/agile), [Unit Testing](https://osherove.com/blog/category/unit-testing)

**Historical article** · Originally published September 28, 2009; technical details may be outdated.

**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.

## More in Agile

[All posts in Agile](https://osherove.com/blog/category/agile)

- Oct 18, 2009

    ### [Introducing Typemock IntelliTest](https://osherove.com/blog/2009/10/18/introducing-typemock-intellitest.html)

- Sep 30, 2009

    ### [Poll: Which mocking\\isolation framework do you use?](https://osherove.com/blog/2009/9/30/poll-which-mockingisolation-framework-do-you-use.html)

- Sep 16, 2009

    ### [Announcing the Team Leadership Google Group](https://osherove.com/blog/2009/9/16/announcing-the-team-leadership-google-group.html)

- Sep 6, 2009

    ### [Introducing 5Whys.com](https://osherove.com/blog/2009/9/6/introducing-5whyscom.html)


---

## About the author

**Roy Osherove**: Senior Solutions Architect at AWS working on AI for production and AI-driven development; author of The Art of Unit Testing and Elastic Leadership, with about 20 years of consulting and training on unit testing, TDD, team leadership and continuous delivery.

### Sites

- [RobotPaper](https://robotpaper.ai/): This blog: AI patterns and anti-patterns, AI and coding agents, and engineering leadership.
- [osherove.com](https://osherove.com): Roy's personal site. Author of The Art of Unit Testing and Elastic Leadership; consulting and training on unit testing, TDD, team leadership and continuous delivery, plus about 20 years of blog posts.
- [The Art of Unit Testing](https://www.artofunittesting.com): The Art of Unit Testing, 3rd Edition (Manning): readable, maintainable, trustworthy unit tests, plus TDD workshops in C#, JavaScript, Java and Kotlin.
- [5whys.com](https://www.5whys.com): Roy's writing on software team leadership: self-organizing teams, surviving chaos, learning mode and the Elastic Leadership model.
- [Pipeline Driven](https://pipelinedriven.org): Continuous delivery and DevOps practices: build patterns, pipeline-friendly testing, DevOps metrics and enterprise DevOps.
- [Elastic Leadership](https://www.elasticleadership.com): Elastic Leadership, Roy's framework for software team leaders (survival, learning and self-organizing modes).

### Social

- X: https://x.com/royosherove
- LinkedIn: https://www.linkedin.com/in/osherove/

### Contact

- Contact form: https://forms.gle/jQSx5KoXvrVA1JCK7

### License

Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page). License: https://creativecommons.org/licenses/by/4.0/
