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
Post a Comment