---
title: "Brown, Green, Refactor"
url: "https://osherove.com/blog/2009/12/31/brown-green-refactor.md"
canonical: "https://osherove.com/blog/2009/12/31/brown-green-refactor.html"
published: "2009-12-31T14:50:56"
updated: "2009-12-31T14:50:56"
tags: [".NET", "Agile", "Unit Testing"]
author: "Roy Osherove"
description: "Having seen enough crappy unit tests to last me a lifetime, I think there should be a parallel to the old “ red-green-refactor ” (from TDD) – it’s evil twin brother should be “ Brown-Green-Refactor ” wherin you’d do a…"
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/"
---

# Brown, Green, Refactor

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

**Historical article** · Originally published December 31, 2009; technical details may be outdated.

Having seen enough crappy unit tests to last me a lifetime, I think there should be a parallel to the old “[red-green-refactor](http://jamesshore.com/Blog/Red-Green-Refactor.html)” (from TDD) –

**it’s evil twin brother** should be “**Brown-Green-Refactor**” wherin you’d do a crappy test first, then make it pass (it could pass for the wrong reasons.. like threads, randoms, dates..), then refactor – the code, not the test.

in red-green-refactor you’d write a _good_ test and remember to also refactor the _test_ when refactoring your code, if needed.

## More in .NET

[All posts in .NET](https://osherove.com/blog/category/net)

- Jan 3, 2010

    ### [Oslo TDD Course – First day canceled](https://osherove.com/blog/2010/1/3/oslo-tdd-course-first-day-canceled.html)

- Dec 31, 2009

    ### [RTM ready tests](https://osherove.com/blog/2009/12/31/rtm-ready-tests.html)

- Dec 30, 2009

    ### [Software Apprenticeship](https://osherove.com/blog/2009/12/30/software-apprenticeship.html)

- Dec 30, 2009

    ### [Test Driven Development Master class in Sydney, Australia](https://osherove.com/blog/2009/12/30/test-driven-development-master-class-in-sydney-australia.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/
