Dynamic tests with mstest and T4
Posted
by Victor Hurdugaci
on Geeks with Blogs
See other posts from Geeks with Blogs
or by Victor Hurdugaci
Published on Sat, 05 Mar 2011 17:30:10 GMT
Indexed on
2011/03/05
23:25 UTC
Read the original article
Hit count: 297
If you used mstest and NUnit you might be aware of the fact that the former doesn't support dynamic, data driven test cases. For example, the following scenario cannot be achieved with the out-of-box mstest: given a dataset, create distinct test cases for each entry in it, using a predefined generic test case.
The best result that can be achieved using mstest is a single testcase that will iterate through the dataset. There is one disadvantage: if the test fails for one entry in the dataset, the whole test case fails.
So, in order to overcome the previously mentioned limitation, I decided to create a text template that will generate the test cases for me. As an example, I will write some tests for an integer multiplication function that has 2 bugs in it:
[Cross post from victorhurdugaci.com]
© Geeks with Blogs or respective owner