Visual Studio Deep Dive: Unit Tests
2h 14mIntermediate2021-08-06
Authors

Walt Ritscher
Programmer, UI Designer, Staff Instructor at LinkedIn Learning
Course details
If you are a responsible programmer, you regularly test your code to make sure it behaves the way you expect it to behave. Unit tests are the most common type of developer test, and most programmers rely on a unit test framework to create and run those tests. In this course, Walt Ritscher takes a deep dive into the unit test tools available in Visual Studio. Walt gives an overview of unit tests and how they integrate with Visual Studio, then takes a deeper look into unit tests with MSTest and xUnit framework and how each is fully integrated into the Visual Studio Test Explorer, He also reviews additional Visual Studio test features like CodeLens, Live Unit Testing, and code coverage.
Skills covered
Visual StudioSoftware TestingWeb Development ToolsSoftware Development ToolsWeb DevelopmentMicrosoftSoftware DevelopmentOne-Off
Concepts
0. Introduction
- 01 - Test your code in Visual Studio
- 02 - What you should know
- 03 - Further lessons and examples
- 04 - Programming setup and configuration
- 05 - How to access the sample code on GitHub
1. Unit Tests Overview
- 06 - What topics are in this course
- 07 - What are unit tests
- 08 - Sample application to test
- 09 - Sample code to test
- 10 - The anatomy of a unit test framework
- 11 - Common test naming conventions
- 12 - Choose a test framework
- 13 - Temporarily disable CodeLens
2. Unit Tests Basics with xUnit Framework
- 14 - Add an xUnit project to solution
- 15 - xUnit conventions and philosophy
- 16 - Create test classes
- 17 - Add test with the Fact attribute
- 18 - Run the unit tests
3. Use Other xUnit Features
- 19 - Example unit tests
- 20 - Parameterized tests with Theory
- 21 - Parameter values with MemberData
- 22 - Parameter values with ClassData
- 23 - Use precision parameter when testing floats
- 24 - How to test for expected exceptions
4. Additional Visual Studio Test Features
- 25 - View unit test results with CodeLens
- 26 - Group the test with test categories
- 27 - Debug unit tests
- 28 - Tip - Clear the test list
- 29 - Run predefined sets of tests
5. Visual Studio Enterprise Features
- 30 - Analyze method test paths with code coverage
- 31 - Analyze all code with code coverage
- 32 - How exceptions affect code coverage statistics
- 33 - Enable Live Unit Testing
- 34 - Refactor code with Live Unit Testing
6. Unit Testing Tips
- 35 - Tip - Run tests after each build
- 36 - Tip - Group by duration or outcome
- 37 - Tip - Filter test list
- 38 - Tip - Save filters with playlists
7. Unit Tests with MSTest
- 39 - Add a unit test project to a solution
- 40 - MSTest examples
- 41 - Run the unit tests in Test Explorer
- 42 - Test for expected exceptions
- 43 - Parameterized and data-driven tests
Conclusion
- 44 - Next steps
Related courses
- Visual Studio Tools for Azure DevOps
- Visual Studio: Advanced Debugging Tools
- SQL Server Data Tools for Visual Studio
- Windows Presentation Foundation 5: Interaction and Controls
- Windows Presentation Foundation: 3 Events and the Event Model
- Windows Presentation Foundation: 2 Layout
- Windows Presentation Foundation: 1 Build Dramatic Desktop Applications
- Java: IDE Overview
Related learn paths
- Master C++
- Advancing Your Azure Developer Skills: Exploring Complex Application Development
- Improve Your JavaScript Language Skills
- Prepare for the Azure Developer Associate (AZ-204) Certification
- Prepare for the AZ-203 Developing Solutions for Microsoft Azure Exam
- Prepare for the Google Associate Android Developer Certification
- Improve Your UX Design Skills
- Design User Experiences with Figma