in

Platinum Bay

Peace, Love, Team System, and Community

This Blog

Syndication


.NETicated

MSTest Digest #1

A couple weeks ago, I became engaged with some folks on Twitter about their specific complaints about MSTest. I received five complaints, some of which I sent off to Microsoft. I’d like to share the answers and Microsoft’s response in hopes of creating more awareness around the tool’s capabilities.

Artifact Cleanup – When tests are run, artifacts such as test results and the (optionally) shadow-copied assemblies are left behind. For a team running many, frequent tests, this can quickly eat up disk space.

In Visual Studio 2008, a new option was created to help alleviate this problem. Under Tools > Options > Test Tools > Test Execution, there is a new setting called Test Result Management which contains a numeric option to limit the number of old test results. For tests executed as part of an automated Team Build, the results should always be scorched by Team Build as they are subsequently stored in the Team Foundation database.

image

Extensibility: Creating custom MSTest attributes is a bit more drawn out than most would like.

Microsoft has simplified the ability to create custom test types by allowing inheritance from existing MSTest attributes. This builds on the Unit Test base and allows you to customize any part (initialize, cleanup, execution) of the test being run.

Transactions – NUnit has an option for Transactional tests, which automatically rollback after the test is run.

This is not provided out of the box. You can either code up the transaction manually (http://www.jimbodriven.com/2007/11/on-unit-tests-seed-data-and.html), or use the extensibility points to create your own test type to handle this.

Data-driven Testing – In NUnit, there is a RowTest attribute which allows data to be specified to use in testing (http://mjeaton.net/blog/archive/2008/11/03/getting-started-with-nunits-rowtest.aspx).

Microsoft is looking into this for future releases. For now, take a look how to achieve this in the current releases. This method has the added benefit of not having to recompile tests to change test data.

Accessibility: It was suggested that MSTest should be available as a standalone, free product, similar to NUnit, MBUnit, xUnit, etc.

Microsoft is looking into this for future releases.

 

So of course my next question is, what else don’t you like about MSTest?

Comments

February 19, 2009 7:00 AM

Pingback from  Dew Drop - February 19, 2009 | Alvin Ashcraft's Morning Dew

 

February 23, 2009 10:16 PM

Link Listing - February 23, 2009

 

February 23, 2009 10:16 PM

ASP.NET ASP.NET ListView: Displaying Hierarchical Data [Via: Adam Pooler ] ASP.NET Dynamic Data Resources...

 

September 28, 2009 7:42 AM

Creating parameterized tests for one. These are hugely useful for tests that have a complexity of testing input (such as any method that parses out a complex deta structure, and you need to test it using multiple inputs)

More importantly, and slightly on a bigger level, the use of hierarchical tests. In other words, a test that for it to pass, it means sub-tests need to pass.

This notion would allow for a BDD approach of specifying a testable requirement, but allowing for the specifications of what it means for that requirement to be met using multiple other tests. For example, you could have a "ShouldProcessAnOrder" test, which has three sub-tests "WhenProcessingAnOrder_ShouldVerifyPaymentDetails", "WhenProcessingAnOrder_ShouldSendOfAnOrderEmail", and "WhenProcessingAnOrder_ShouldLogOrderRequest".

 

Leave a Comment

(required )  
(optional )
(required )  
Add

About Steve

Steve Andrews is a Team System MVP and INETA Speaker, and has been working as a developer for more than 9 years. During this time, he has designed and developed applications in such widely varying areas as trust accounting, medical information management, supply chain management, and retail systems. Steve is also an MCP, ICSOO, Speaker Liaison for the Philly .NET User Group, and community fanatic.
Powered by Community Server (Commercial Edition), by Telligent Systems
© Platinum Bay | Some Rights Reserved Creative Commons License

Disclaimer: The information in this weblog is provided "AS IS" with no warranties, and confers no rights. This weblog does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion. Feel free to challenge me, disagree with me, or tell me I'm completely nuts in the comments section of each blog entry, but I reserve the right to delete any comment for any reason whatsoever (abusive, profane, rude, or annonymous comments) - so keep it polite, please.