Add a RowTest attribute to MSTest to facilitate parameterized tests.
It would be great to have a RowTest attribute (like in NUnit) added to facilitate parameterized tests, like:
[RowTest]
[Row(10, 10, 100)]
Public void Add_MultipleValues_ReturnsSum(int x, int y, int expected) { … }
I have added an item in the product backlog for this.
5 comments
-
Anonymous
commented
Actually Microsoft has a working implementation for this, they just need to release it :
http://blogs.msdn.com/b/vstsqualitytools/archive/2009/09/04/extending-the-visual-studio-unit-test-type-part-2.aspx -
Sean Hanna
commented
This is probably the most needed feature in mstest, but i'd like to try and steal some votes for this suggestion instead: http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/3474089-fix-roadblocks-to-building-mstest-extensions
If we could extend mstest ourselves (and especially without having to build installers), we wouldn't need to beg microsoft for trivial new features, for projects they haven't updated in years.
-
Michael Freidgeim commented
There are a few workarounds listed in http://stackoverflow.com/questions/347535/how-to-rowtest-with-mstest/12755816#12755816, but have rowtest out of the box will be good.
-
Waldyr commented
I totally agree, it's the only one feature that I really miss in the MSTest. I wish do multiple tests with several parameters without need of a .csv data source.
-
Peter Provost [MSFT]
commented
I agree that I would like to see more choices for providing data to parameterized tests. The [Row] is one option, but another (from xUnit.net) is the idea of a little data provider class. More flexibility is better.