---
title: "Debugging Unit tests using the VS.net debugger"
url: "https://osherove.com/blog/2004/1/9/debugging-unit-tests-using-the-vsnet-debugger.md"
canonical: "https://osherove.com/blog/2004/1/9/debugging-unit-tests-using-the-vsnet-debugger.html"
published: "2004-01-09T15:12:00"
updated: "2004-01-09T15:12:00"
tags: [".Net Original", "Cool Articles"]
author: "Roy Osherove"
description: "[ Update : Bah ! how silly am I? Turns out you can do the same thing I outline here only much much easier using the amazing NUnit-Addin. It has a \"Test with Debugger\" command that allows you to do just what I explain…"
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/"
---

# Debugging Unit tests using the VS.net debugger

By Roy Osherove January 9, 2004 In [.Net Original](https://osherove.com/blog/category/net-original), [Cool Articles](https://osherove.com/blog/category/cool-articles)

**Historical article** · Originally published January 9, 2004; technical details may be outdated.

\[**Update**:**Bah**! how silly am I?

Turns out you can do the same thing I outline here only much much easier using the amazing [NUnit-Addin.](http://sourceforge.net/project/showfiles.php?group_id=64706)  It has a "Test with Debugger" command that allows you to do just what I explain here without needing to invoke the Nunit gui program from the debugging options. How very cool. Guess you learn something new every day...\]

Here's a very easy way to debug your unit tests line by line using the vs.net debugger (you shouldn't need to do this too often if you're doing Test Driven Development correctly though):

- Set the testing project as the startup project in the solution(so you can start debug with F5)
- Open the project properties of the project with all the tests
- In the Configuration Properties->Debugging , set the "start action" to "start external program" and select the Nunit-gui.exe or the Nunit-console.exe
- If you selected the console program, put the name of your assembly in the parameters to send to this program

That's it. Now, to start debugging:

- Place a breakpoint anywhere in the code that will be tested (either a test or a code that is used by the test)
- Hit F5.
- If you chose to debug using the Nunit gui application, just hit "run" on the tests you want and let the debugger stop at the breakpoint you want.If you are debugging by starting the console application you will get to that breakpoint automatically eventually (all the tests in the assembly will be run).

Find out more in [this article](http://www.xprogramming.com/xpmag/acsUsingNUnit.htm#N390)

## Lessons on this topic

- [Debugging Excursions](https://courses.osherove.com/courses/tdd-pairing-sessions-building-a-go-game/debugging-excursions/) · TDD Pairing Sessions - Building a Go Game

## More in .Net Original

[All posts in .Net Original](https://osherove.com/blog/category/net-original)

- Jan 10, 2004

    ### [New MSDN article: Turn Your Log Files into Searchable Data Using Regex and the XML Classes](https://osherove.com/blog/2004/1/10/new-msdn-article-turn-your-log-files-into-searchable-data-us.html)

- Jan 9, 2004

    ### [IntelliJ IDEA blows my mind again](https://osherove.com/blog/2004/1/9/intellij-idea-blows-my-mind-again.html)

- Dec 29, 2003

    ### [Another article of mine published on MSDN: Search Dynamically for Plug-Ins](https://osherove.com/blog/2003/12/29/another-article-of-mine-published-on-msdn-search-dynamically.html)

- Dec 27, 2003

    ### [Code: CRUD base classes for unit testing](https://osherove.com/blog/2003/12/27/code-crud-base-classes-for-unit-testing.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/
