Presentation is loading. Please wait.

Presentation is loading. Please wait.

Dave Lloyd www.ObjectSharp.com/Blogs/Dave www.ObjectSharp.com/Blogs/Dave Unit Testing in the Real World.

Similar presentations


Presentation on theme: "Dave Lloyd www.ObjectSharp.com/Blogs/Dave www.ObjectSharp.com/Blogs/Dave Unit Testing in the Real World."— Presentation transcript:

1 Dave Lloyd www.ObjectSharp.com/Blogs/Dave www.ObjectSharp.com/Blogs/Dave Unit Testing in the Real World

2 Anatomy of a Test Fixture Beware of the.VSMDI Using the.testrunconfig Expected Exceptions Data Driven Tests Mock Objects Ignore & Inconclusive Test Driven Development Static Code Analysis and Code Coverage

3 Test Class and Test Method TestContext Property

4 Meta Data for Test Manager Must have VS for Testers or Team Suite Not a part of VS for Developers Don’t Merge this file! To add tests to a Team Build you need this file

5 Creating and using your own Deployment Code Coverage Setup and Cleanup Batch Files

6 ExpectedException Attribute Validate the correct Exception was raised

7 DataSource Attribute Execute a test using test data

8 The Crash Test Dummies of Unit Testing Simulated Object Same Interface as the Real Object Why Create a Mock Object Real one doesn’t exist yet Difficult to produce within a test

9 Ignore Tell VSTS to ignore a test Assert.Inconclusive Show test in test results with message Reminder of an Inconclusive Test

10 Available in C# The Process Write a Test Execute and see it fail Write the code Execute the test and see it pass Smart Tag allowing you to Generate a method Stub in the code being tested

11

12

13 Blogs on TDD: James Newkirk - blogs.msdn.com/jamesnewkirk Brian Marick - www.testing.com/cgi-bin/blog Jonathan de Halleux - http://blog.dotnetwiki.org/ Jose Almeida - blogs.msdn.com/josealmeida/ Scott Densmore – blogs.msdn.com/scottdensmore Code Project -www.codeproject.com/dotnet/tdd_in_dotnet.asp TestDriven.com - www.testdriven.com Books: Test-Driven Development in Microsoft.Net By James W. Newkirk & Alexei A. Vorontsov Test Driven Development: A Practical Guide By David Astels Test Driven Development: by Example By Kent Beck

14 Unit Testing in the Real World Dave Lloyd Partner, ObjectSharp Consulting www.ObjectSharp.com/Blogs/Dave

15 Assert CollectionAssert To Compare Collections of Objects StringAssert To Compare Strings

16 UnitTestAssertException Base Exception AssertFailesException Thrown when an Assertion Fails AssertInconclusiveException Test is not complete InternalTestFailureException Internal failure for a test

17 Unit Testing in the Real World Dave Lloyd www.ObjectSharp.com/Blogs/Dave www.ObjectSharp.com/Blogs/Dave


Download ppt "Dave Lloyd www.ObjectSharp.com/Blogs/Dave www.ObjectSharp.com/Blogs/Dave Unit Testing in the Real World."

Similar presentations


Ads by Google