Explain how to run the failed test cases, what are the best practices to follow and what are the solutions that will be provided in test automation
There are two ways to re-run failed test cases in the testing framework.
-
You can use test Ng failed XML file and just right-click file and click on run option
-
You can also use a retry analyzer to run failed test cases at the time of execution.just need to define count how many times you want to run failed test cases in the testing framework
we can also use I-analyzer transformer which is a better way to run failed test cases. Bcz we need to add this at the method level but in case of retry i-analyzer we need to add it with every class.
You can write a retry logic using annotation transformers in Testing. Using Testing we have the option to execute Failed Test cases. After completion of the suite execution; just refresh the project folder and there you can find a folder called “test-output” and you can find an XML file called “TestNG-failed.xml”. This XML file contains only failed test cases. So, we can execute this xml file to rerun the failed test again by using the IRetryAnalyzer interface.