Test Explorer provide a debugging tool that enables the developer to debug a test method (and the System Under Test code) from within the test project. This tutorial shows how to debug a test method.
- View Offline
- Exercise Files
- [Voiceover] I just ran my tests in Test Explorer…and I have two failing test.…I spent a few minutes looking at the code…in my system under test…and I can't figure out what the problem is.…So at this point I would like to debug my code,…I'd like to debug my unit testing code…to see if there's a problem there…and I'd also like to debug the system under test.…The question is how do I attach a debugger?…Since both of these projects are class libraries…I can't just make this project a startup…and then choose to debug,…because I get this error dialog,…a project with an output type of class library…cannot be started directly.…
Now it's possible to debug my unit test,…you just have to know how to start things.…I'm getting a failing test on this method,…ReturnMonday_WhenProposedDateFallsOnSaturday.…You can double-click on the name of the test…in Test Explorer…and it'll take you to your unit test method.…I'll put a break point here on line 42…by pressing in the margin with my mouse…and now I'm ready to debug.…Right-click on the unit test…
- Examining types of frameworks
- Choosing a naming convention
- Creating unit tests
- Running unit tests with Visual Studio
- Modifying and correcting code
- Handling exceptions
- Installing and using nUnit
- Viewing test results with CodeLens
Skill Level Intermediate
1. Create a Simple Unit Test Framework
2. Unit Testing Conventions
Choose a naming convention5m 59s
3. Work with Visual Studio Unit Testing Framework
4. Work with xUnit
5. Work with nUnit
6. Additional Topics
Next steps1m 1s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.