---
title: "What does the 'unit' in 'unit test' mean?"
url: "https://osherove.com/blog/2012/5/15/what-does-the-unit-in-unit-test-mean.md"
canonical: "https://osherove.com/blog/2012/5/15/what-does-the-unit-in-unit-test-mean.html"
published: "2012-05-15T16:02:45"
updated: "2012-05-15T16:02:45"
tags: ["Unit Testing"]
author: "Roy Osherove"
description: "I used to think it was a method. Then I thought it coule be several methods. then I thought it might be several classes. then I realized it changes all the time. It means “unit of work”. A unit of work is a use case in…"
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/"
---

# What does the 'unit' in 'unit test' mean?

By Roy Osherove May 15, 2012 In [Unit Testing](https://osherove.com/blog/category/unit-testing)

**Historical article** · Originally published May 15, 2012; technical details may be outdated.

I used to think it was a method. Then I thought it coule be several methods. then I thought it might be several classes. then I realized it changes all the time.

It means “unit of work”.

A unit of work is a use case in the system, that is initiated by a public method somewhere, and ends up with an end result. An end result can be one of three things:

- A return value(if the public method is a function) or an exception return value
- A **noticeable** change to the state of the system under test. **Noticeable** means that the system behaves differently to an end user than it did before. For example - adding a user changes the system behavior to allow that user to login in. 
- A call to a 3rd party system. A 3rd party system is a dependency that we do not have control over in our test. If it touches the file system, or calls the network, or uses threads, or anything that makes our test slow, or inconsistent, it is a dependency we don’t have control over.

The third case (3rd parties) is where we end up using mock objects. In all other cases, we might have stubs to break dependencies, but our asserts will be against the system’s different states, or different return values.

## More in Unit Testing

[All posts in Unit Testing](https://osherove.com/blog/category/unit-testing)

- May 16, 2012

    ### [Test Driven Validation Logic with Extract & Override](https://osherove.com/blog/2012/5/16/test-driven-validation-logic-with-extract-override.html)

- May 15, 2012

    ### [Test Naming Conventions With Unit of Work](https://osherove.com/blog/2012/5/15/test-naming-conventions-with-unit-of-work.html)

- Oct 6, 2011

    ### [Free event and 5 day TDD masterclass in Copenhagen this month](https://osherove.com/blog/2011/10/6/free-event-and-5-day-tdd-masterclass-in-copenhagen-this-mont.html)

- Aug 24, 2011

    ### [Why MSTest is the IE6 of unit test frameworks](https://osherove.com/blog/2011/8/24/why-mstest-is-the-ie6-of-unit-test-frameworks.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/
