c# - How can I repeat a failed test so that it only fails after x amount of repeats? -


we developing selenium tests using visual studio , c# , using visual studio's inbuilt test runner run tests. set schedules run our tests through vstest.console.exe. issue having periodically, tests fail though have ran 10 times previously. expect little of have stakeholders getting mail alerts failing tests , panic :)

what hoping try , cut down on false positives repeating failed test x number of times. 3 times. if after test has been repeated 3 times , still fails, fail test @ point. has implemented this? have been looking around can't find examples

you use try/finally statement callback testmethod :

static int numbertest = 3;      [testmethod]     public void globaltest()     {         try         {             // failed code             assert.fail(); // remove of course         }                 {             numbertest--;             if (numbertest > 0)                 globaltest();         }     } 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -