views:

384

answers:

1

I find the TestCase feature in NUnit quite useful as a quick way to specify test parameters without needing a seperate method for each test. Is there anything similar in MSTest?

 [TestFixture]  
 public class StringFormatUtilsTest  
 {  
     [TestCase("tttt", "")]  
     [TestCase("", "")]  
     [TestCase("t3a4b5", "345")]  
     [TestCase("3&5*", "35")]  
     [TestCase("123", "123")]  
     public void StripNonNumeric(string before, string expected)  
     {  
         string actual = FormatUtils.StripNonNumeric(before);  
         Assert.AreEqual(expected, actual);  
     }  
 }
+1  A: 

MSTest doesn't support RowTests - but this may be helpful to simulate it by pulling test values from an external datasource. I haven't tried it, so YMMV.

http://codeclimber.net.nz/archive/2008/01/18/How-to-simulate-RowTest-with-MS-Test.aspx

Bramha Ghosh