Fernando Machado Píriz's Blog

Posts about digital transformation, enterprise architecture and related topics

Using Pex and Contracts to generate unit tests in Visual Studio 2010 and C# 4.0

with one comment

This is the fourth post of a series about testing tools and techniques using Visual Studio 2010, Team Foundation Server 2010, Microsoft Test Manager 2010, and C# 4.0.

In a previous post I showed how to use Pex to automatically generate unit tests with high code coverage.

Contracts is a tool from Microsoft Research for Visual Studio implementing design by contract for the .NET Framework. Using Contracts, Pex generates better test cases. To get more details on how to use Pex and Contracts together, read this post.

In this video you will see how to add a precondition to a Factorial method of a Calculator class, and how Pex generates new test cases for this method.

You can also download the video.

More videos coming soon… keep tuned!

Written by fmachadopiriz

May 24, 2010 at 6:56 pm

One Response

Subscribe to comments with RSS.

  1. […] Using Pex and Contracts […]


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: