onTestFailure Hook?
See original GitHub issueI am looking through the documentation, although I could have missed it, and it would be nice to have an onTestFailure hook or something similar, where when a test fails, I would call client.getLog and print the log associated to that failure.
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
javascript - Jest onFailure hook
I have found that there is onTestFailure option when setting up a test-runner, is it possible to leverage that?
Read more >TestNG Listeners In Selenium Webdriver For Automated ...
onTestFailure : This method invokes every time a test case fails. Syntax: void onTestFailure(ITestResult result);.
Read more >Test Listeners (Test Hooks) - #13 by nguyenlehoangquynh
Ideally, I'd have a hook point much earlier in the executor thread and abort there. ... OnTestSuccess, OnTestFailure, OnTestFinish, etc.
Read more >Playwright Test Hooks
Today in this article, we will be looking at different test hooks ... the new worker as the worker process is restarted on...
Read more >Save The Page On Test Failure
Save The Page On Test Failure ... In the support file register the afterEach hook to save the full page if a test...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I have the same problem. It would be very useful to somehow get the console logs when the test fails.
@MateuszJeziorski sorry to dig out old issue but I tried that solution, I check
browser.currentTest.results.failedand try to access logs withgetLogsbut all I get is that exception that points to a session being closed. I do not call.end()anywhere manually for the purpose of this test.org.openqa.selenium.NoSuchSessionException