Run TestFixture multiple times using Nunit or Jenkins
As Steve says, a parameterized fixture works, but if you want to run your test hundreds of times, it would get fairly tedious to copy and paste that many attributes.
A better option in NUnit is to use the TestFixtureSource attribute on your fixture. For example, the following code will run your test fixture 100 times;
[TestFixtureSource("TestData")]public class MultipleRunFixture{ int _counter; public MultipleRunFixture(int counter) { _counter = counter; } public static IEnumerable<int> TestData => Enumerable.Range(0, 100); [Test] public void TestMethod() { // TODO: Add your test code here Assert.Pass($"Test run {_counter}"); }}
You could make it a paramterized fixture: then the fixture would run as many times as you have added the attribute:
[TestFixture(4)][TestFixture(3)][TestFixture(2)][TestFixture(1)]public class MyTestFixture{ public MyTestFixture(int counter) { }
Thanks to Steve and Rob for the answers. All of them are good options but I tried another approach and it turned out to be the best solution for my case. So just putting it here for anyone else who stumbles upon it.
I created a Jenkins job for that test fixture and used a cron time to repeat the test regularly, say every 2 minutes. This way, Jenkins ran the job many times and even collected the stats for me (e.g. test failure rate).