0

A C# solution has thousands of test methods which use randomization to create random inputs to the methods being tested.

  • I would like to run the test methods which have a string in the middle of the test methods' names. There are hundreds of them.

  • I also would like to run them a large number of times, e.g. 100 times, so that the randomization can cover the input space well and failure of any test method will have a better chance to be discovered.

But doing that in the Text Explorer window of visual Studio 2015 by mouse clicking and waiting seems very tedious and inefficient. How can i automate that as much as possible? Is it possible to run the test methods in interest a specific number of times and get the info of which method fails in command line?

Thanks.

Tim
  • 1
  • 141
  • 372
  • 590
  • It perhaps with nunit framework. Maybe it gets you some helpful ideas and you find a way how to do that with vstest. You can use **TestCaseSource** and enumerate tests input data. So, for example, you can enumerate 100 string and test explorer will show you 1 test that contains 100 calling or it will show you 100 tests if you set name for all of calling (it's **TestCaseData**). – George Alexandria Jun 11 '17 at 14:31
  • Thanks. i am using Visual Studio unit test framework. Is nunit better? – Tim Jun 11 '17 at 15:05
  • I did not use vstest, so I cannot compare they, but all my ideas were resolved with nunit, and I think that nunit is better. By the way, the stackoverflows community agrees with me: [link1](https://stackoverflow.com/a/22654240/5359302), [link2](https://stackoverflow.com/a/38064899/5359302) – George Alexandria Jun 11 '17 at 15:21
  • The tests were not written by me, so I didn't choose vstest. Is it impossible to do what I hope with vstest? – Tim Jun 11 '17 at 15:39
  • If you can not modify test and project, I don't know how do that, but if you can, see [OrderedTests](https://msdn.microsoft.com/en-us/library/ms182631(v=vs.140).aspx) and [DataSourceAttribute](https://stackoverflow.com/a/43395578/5359302) – George Alexandria Jun 11 '17 at 16:23

0 Answers0