---
title: "Tests should reflect required reality"
url: "https://osherove.com/blog/2005/4/5/tests-should-reflect-required-reality.md"
canonical: "https://osherove.com/blog/2005/4/5/tests-should-reflect-required-reality.html"
published: "2005-04-05T10:01:00"
updated: "2005-04-05T10:01:00"
tags: ["Agile Related", "Testing Guidelines"]
author: "Roy Osherove"
description: "One of the most common mistakes of newcomers into TDD is that they often mistake the “Fail first” requirement with “Fail by testing something illogical”. For example, given a method requirement with this spec: Int…"
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/"
---

# Tests should reflect required reality

By Roy Osherove April 5, 2005 In [Agile Related](https://osherove.com/blog/category/agile-related), [Testing Guidelines](https://osherove.com/blog/category/testing-guidelines)

**Historical article** · Originally published April 5, 2005; technical details may be outdated.

One of the most common mistakes of newcomers into TDD is that they often mistake the “Fail first” requirement with “Fail by testing something illogical”. For example, given a method requirement with this spec:

**Int Sum(int a, int b)** : _returns the sum of the two numbers_

They would write a failing test like this

**\[Test\]**

**Public void Sum\_AddsOneAndTwo()**

**{**

     **int result = Sum(1,2);**

     **Assert.AreEqual(4, result, “bad sum”);**

**}**

While this might feel like a good way to make a failing test, it totally misses the idea of why we actually want to write a failing test. A failing test proves that there is something wrong _with the production code_. That is, the test should pass _as is_ when the production code is fully done. As things stand with the test above – it is not logical and will fail even if the production code is complete. Making it pass requires changing the test itself – instead of making us change or add something to the production code. In short – this test does not reflect the end-reality like we would like it to be when the production code is complete, thus is not a good test.

_On a more philosophical note_

A good test in TDD will make us _change the reality of the code_ to make it work, instead of reflecting the reality right now or reflecting a wrong reality (where 1+1 returns 0 just to fail the test).

We want the tests to reflect the reality _like it should have been/we want it to be_ if the current requirement would have worked, then we make reality adjust to our needs.

## Lessons on this topic

- [Total Noob Fail](https://courses.osherove.com/courses/tdd-pairing-sessions-building-a-go-game/total-noob-fail/) · TDD Pairing Sessions - Building a Go Game

## More in Agile Related

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

- Apr 8, 2005

    ### [\[Free eBook\]FIT for Developing Software: Framework for Integrated Tests](https://osherove.com/blog/2005/4/8/free-ebookfit-for-developing-software-framework-for-integrat.html)

- Apr 5, 2005

    ### [What Algorithms should you test and how?](https://osherove.com/blog/2005/4/5/what-algorithms-should-you-test-and-how.html)

- Apr 3, 2005

    ### [Scrum at Microsoft](https://osherove.com/blog/2005/4/3/scrum-at-microsoft.html)

- Apr 3, 2005

    ### [How Do You Explain Pair Programming?](https://osherove.com/blog/2005/4/3/how-do-you-explain-pair-programming.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/
