Unit Testing with MSTest

A mechanical course on the Visual Studio Unit Testing capabilities
Course info
Rating
(358)
Level
Intermediate
Updated
Apr 25, 2011
Duration
3h 4m
Table of contents
Introduction to Microsoft Unit Testing Framework
Asserts and Testing Lifecycle
Types of Tests
Miscellaneous Unit Test Features
Description
Course info
Rating
(358)
Level
Intermediate
Updated
Apr 25, 2011
Duration
3h 4m
Description

In this course you will be learning about using Microsoft Visual Studio Unit Testing features. We will cover understanding unit testing basics, asserts and testing lifecycle, web performance tests, generic tests, ordered tests, WebServiceHelper and TestConfigurationSection.

About the author
About the author

Phani Tipparaju is a Consulting Architect and co-founder of BrainScale consulting where he focuses on helping various customers with their architecture, design efforts and mentoring of developers.

Section Introduction Transcripts
Section Introduction Transcripts

Introduction to Microsoft Unit Testing Framework
Hi, welcome to this module, Unit Testing Basics. My name is Phani Tipparaju, and I'll be taking you through this module. Unit testing is an example of white-box testing, where knowledge of internal implementation is used to identify the best ways to test an application. In this module, we will be looking at writing, executing, and managing unit tests using Visual Studio unit testing framework. So we'll start by having a look at why you need unit testing framework in the first place, and what this unit testing framework is all about. We will go on and write our first unit test, and then we'll explore ways to manage and run these unit tests, because once the number of unit tests grow in size, it's important to effectively manage them. We'll then look at debugging of unit tests. We'll also look at code gen option, where you can auto generate your unit tests from code. Towards the end, we'll also look at MSTest. exe, the command line way to execute these unit tests.

Types of Tests
Hi, I'm Phani Tipparaju with Pluralsight, and I'll be presenting this module Web Performance Test. So this is a testing type available to us in Visual Studio. It's a new name, but under the covers it's still the same web test as we used to call it in Visual Studio 2008. It is renamed to Web Performance Test to highlight the primary scenario for web tests, which is using them as scripts in a load test. That said, you should not underestimate the power of web performance testing from a functional or unit testing perspective, which is the focus of this module.

Miscellaneous Unit Test Features
Hi, this is Phani Tipparaju with Pluralsight. This module is a grouping of features which didn't really fit into any one of the earlier modules. That's why we have titled it as Miscellaneous Unit Test Features. To begin with, we will look at Ordered Tests. As we saw in Asserts and Testing Lifecycle module, there is no one particular order in which tests in a project get executed, but sometimes you would want your tests to be executed in a particular order, and that's where ordered tests come into the picture. This is a test type in which you can order your existing tests so that they run in a particular sequence. We will then go on to cover generic tests. This is an another type of test, and here we'll see how it comes in handy while dealing with an existing test, a program, or a third-party tool. We'll then shift our focus to unit test attributes. So in previous modules, we did cover some commonly used unit test attributes, like test class, test method, various attributes for initialization and cleanup of unit tests, and so on. In this module, we will cover a few other attributes, which could prove useful in quite a few scenarios. We'll then move on to cover WebServiceHelper. So this class contains helper methods for testing web services, so we'll have a look at that. And towards the end, we will look at the feature called TestConfigurationSection. For example, if we look at data source test attribute, instead of forwarding details in the attribute itself, we could move them to a config file and link it to this attribute by providing the name in the config section.