0

I am running a suite of 200+ UI test cases and due to some or other reason, 10 or 15 test cases fail. If I rerun them they pass. I want to re-run this random failing 10-15 test case after the execution is completed. I can't use Retry because It is method level and I am not sure which test case will fail and I can't give retry to all the 200+ test cases. I need something which will just re-run the failing test cases at the end.

I am using Test Explorer to run test cases I am running on a Desktop as well as on Jenkins

  • 1
    Please edit to tell us how you are running the tests. I.e., nunit3 console, test explorer, other runners. Desktop execution or under a CI run? – Charlie Sep 28 '22 at 17:28
  • @Charlie I am using nunit3 and I am facing the same issue. Can you suggest something or any workaround? – Akshay Sarode Mar 08 '23 at 14:43
  • Same question. The NUnit framework allows writing tests. This is a question about running and re-running tests. That's the job of the runner. There are three runners produced by the NUnit project and many more third party runners, including my own GUI runner. If you do not name the runner in a question, you are asking for a major essay about all the ways of running NUnit tests. Hey! That's a good idea. :-) But not suitable for SO. :-( – Charlie Mar 09 '23 at 15:10

1 Answers1

0

Since you're using Test Explorer, just display the test cases sorted by outcome. Select the failed tests group and run them.

Charlie
  • 12,928
  • 1
  • 27
  • 31
  • yes, I can do this but this has manual intervention. Can we do anything at the program level? Like Nunit has a RETRY attribute. But won't be feasible to add Retry on all the tests. I need something that will automatically re-run failed test cases at the end. – Akshay Sarode Mar 10 '23 at 15:15
  • You said you were using Test Explorer, which I took to mean you were running tests manually under the Visual Studio Test Explorer window. Are you running some other way then? If so, I'll update the answer. – Charlie Mar 11 '23 at 16:10
  • While testing on local I use test explorer to run the test cases. But I run the same test cases on Jenkins as well using nunit console by giving command "dotnet test". Some test cases which fails on Jenkins passes after re run. Hence i need a logic to re run test cases. – Akshay Sarode Mar 13 '23 at 10:44
  • Do you have any update on this one? – Akshay Sarode Mar 24 '23 at 15:13
  • If you mean you want Jenkins to detect the type of failure (i.e. failed cases) and rerun just those that failed, the console runner cannot do that. I don't know if Jenkins can. – Charlie Mar 25 '23 at 17:22