How do you write good parameterized unit tests? Where do they work the best? Are there some Test Patterns ? Anti Patterns?
This is the kind of questions that we have received many times from Pex users. We just released Pex 0.7 which contains a list patterns and anti-patterns for parameterized unit testing (this is still a draft but we feel that we already have a number of good patterns that would be helpful for anyone giving a shot at Pex):
Note that most of the patterns in this document are not Pex specific and apply to parameterized unit tests in general; including MbUnit RowTest/CombinatorialTest/DataTest, NUnit RowTest, MSTest Data Test, etc…
The amazing ‘quadruple A’ pattern
The ‘triple A’ pattern is a common way of writing a unit test: Arrange, Act, Assert. Even more ‘A’crobatic, we propose the ‘quadruple A’ where we added one more ‘A’ for assumption:
Pex is an automated white box testing tool from Microsoft Research. More information at http://research.microsoft.com/pex.
Page rendered at Thursday, December 04, 2008 7:39:47 AM UTC
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.