Frage

I'm currently dealing with the usual flakiness of the latest version of Chrome and ChromeDriver with Selenium. I'm running my tests using Grid 2 and a couple of Windows 7 machines. I'll get the occasional inevitable dead browser tab being reported by ChromeDriver. Since these tests didn't really fail as far as the web app functionality, I'd like to mark them as skipped to keep reporting a bit more useful for my current purpose. I've tried getting them to re-run, but TestNG's support for this is experimental and currently broken.

Is there a way I can set these tests to a SKIPPED status before they're logged in my Gradle report? (I'm using Gradle for reporting instead of ReportNG since ReportNG doesn't work properly with parallel testing).

I'm thinking I need to add another listener and somehow pick up the reported stack trace, check for a particular string, and then set the set to SKIPPED. Is this the correct approach?

Any tips on how to accomplish this would be great. I'm not able to find a way to capture the stack trace with my listener yet, and most importantly, set the test to a SKIPPED state (once the trace is parsed). I am using Java to drive these tests.

Any ideas / help would be much appreciated!

Cheers, Darwin

War es hilfreich?

Lösung

You may try to implement the interface ITestListener, in onTestFailure() check the stack trace and call setCurrentTestResult() method to set the Skipped status.

Don't forget to make the implemented class a listener as described in '5.17 - TestNG Listeners' of TestNG documentation.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top