0845 450 6120

Unit testing in Visual Studio 2013

This two-day, instructor-led course provides delegates with the knowledge and skills to effectively use Visual Studio 2013 to design, write, and run high-quality .NET unit tests. The course focuses on the applicable features and capabilities of Visual Studio as it relates to unit testing and Test-Driven Development (TDD).

This course also introduces other, popular unit testing tools and techniques, and demonstrates how they integrate with Visual Studio and your development lifecycle.

Target Audience

This course is intended for current software development professionals who are involved with building high-quality .NET applications. Students will use Visual Studio while learning how to design, write, and run unit tests. They will also learn many relevant practices and techniques, such as TDD, CI, refactoring, and how to test difficult code.

We don't currently have any courses listed for Unit testing in Visual Studio 2013, would you like to view all courses for Microsoft Technical?

Learning Objectives

This course teaches students how to effectively design, write, and run high-quality unit tests using Visual Studio. At course completion, attendees will have had exposure to:

  • Why unit tests are critical to software quality
  • How unit tests and integration tests differ
  • Popular unit testing frameworks
  • The anatomy of a unit test
  • The 3A pattern (Arrange, Act, Assert)
  • Assertions and expected exceptions
  • Test class inheritance
  • Testing private methods
  • Visual Studio test projects
  • Visual Studio test windows and tools
  • How basic and standard unit tests differ
  • How and when to use categories and lists
  • How and when to use ordered tests
  • Running tests and managing test results
  • The importance of Test-Driven Development
  • Implementing TDD in Visual Studio
  • How to effectively refactor within TDD
  • Why and how to refactor legacy code
  • Happy path vs. sad path testing
  • Testing boundary conditions
  • Organizing tests and test assemblies
  • Behavior-Driven Development principles
  • How to use data-driven unit tests
  • Why and how to calculate code coverage
  • Why and how to use test impact analysis
  • Team Foundation Server support for testing
  • Team Foundation Build support for testing
  • Why and how to use continuous integration
  • Using dummies, fakes, stubs, and mocks
  • Why and how to use Microsoft Fakes
  • Why and how to use Rhino Mocks
  • Why and how to use Microsoft Code Digger

Pre-Requisites

Before attending this course, students should have experience or familiarity with:

  • Building a high-quality software product
  • Writing, debugging, and maintaining code
  • The Visual C# language
  • Visual Studio 2010, 2012, or 2013
  • Their organization's development lifecycle

Course Content

Unit Testing in .NET
This module introduces the concepts of unit testing and how it is supported by various unit testing frameworks and tools for .NET, including MSTest and NUnit. The anatomy of a unit test is also detailed in this module.

Lessons

  • The role of the developer
  • Unit tests explained
  • .NET unit testing frameworks (MSTest.exe and others)
  • Writing unit tests

Hands-on

  • Setup the learning environment
  • Create and run a unit test
  • Create and run an integration test
  • Migrate NUnit tests to MSTest (optional)

Unit Testing in Visual Studio
This module introduces Visual Studio test projects, the testing windows, and the functionality for effectively writing and running unit tests and managing test results.

Lessons

  • Testing support in Visual Studio
  • Test projects
  • Test Explorer and other windows
  • Unit testing in Visual Studio
  • Managing a large number of tests
  • Running tests
  • Managing test results

Hands-On

  • Review existing codebase and tests
  • Execute tests in various ways
  • Manage a large number of tests
  • Execute tests in sequence
  • Manage tests using test lists
  • Manage test results

Test-Driven Development (TDD)
This module introduces Test Driven Development (TDD) and the business case for why you should practice it. Refactoring as well as a discussion of how to work with legacy code are also a part of this module.

Lessons

  • TDD overview, benefits, and common objections
  • Implementing TDD in Visual Studio
  • Refactoring
  • Legacy Code

Hands-On

  • The Bowling Kata
  • TDD and Refactoring

Writing Good Unit Tests
Just knowing how to write unit tests and being disciplined in TDD is not enough. This module will demonstrate several other practices for ensuring that you write high-quality unit tests.

Lessons

  • Know your code
  • Path testing (i.e. sad path)
  • Right BICEP
  • Testing for expected exceptions
  • Maintaining high-quality test code
  • Behavior-Driven Development (BDD)
  • BDD naming conventions
  • Organizing test libraries (assemblies)

Hands-On

  • Handle bad input values
  • Refactor unit tests
  • Add a sad path test
  • The challenge!

Advanced Unit Testing Tools
This module examines additional unit testing features found in Visual Studio, including code coverage, data-driven unit tests, and test impact analysis. In addition, many unit-testing specific features in Team Foundation Server and Team Foundation Build will be part of the discussion.

Lessons

  • Code coverage
  • Data-driven unit tests
  • CodeLens (Ultimate edition)
  • Test impact analysis
  • Team Foundation Server
  • Team Foundation Build
  • Build verification tests (BVTs)
  • Gated check-ins
  • Continuous Integration (CI)

Hands-On

  • Use a data-driven unit test
  • Calculate code coverage
  • Use test impact analysis
  • Using CodeLens (optional)

Testing Difficult Code
This module introduces some tools and techniques for testing difficult code, such as code that can't be tested without being hosted in another environment (i.e.ASP.NET, SharePoint, etc.)

Lessons

  • The need to isolate code under test
  • Doubles (dummies, stubs, fakes, and mocks)
  • Mocking frameworks (Rhino Mocks)
  • Fakes framework (Ultimate edition)
  • Microsoft Code Digger

Hands-On

  • Explore Microsoft Fakes framework
  • Explore Rhino Mocks (optional)
  • Explore Microsoft Pex (optional)
One Month
Two Months
Three Months
More than Three Months
PRINCE2 Foundation & Practitioner
MSP Foundation & Practitioner
APMP Certificate
ITIL Foundation
Scrum in One Day
Certified ScrumMaster
ISTQB Software Test Foundation
Microsoft Project
BCS Business Analysis Practice
Other - Please Specify Below

Our Customers Include