I am working on project that has a lot of selenium tests. The tests are run using the python binding of selenium and python unittest. When tests fail then unittest displays the exception stack trace and error message. For most of the tests this is not enough information to debug the problem. Screenshot of the browser and a copy of the browser log would be very helpful.
So what I want is: if a test fails, before closing the selenium driver I want to take a screenshot and save it somewhere. For that I need a function much like tearDown() but it should be called only when a test fails. I looked at the source code of unittest and specificaly the TestCase class and couldn't find anything. Can you help?
P.S. I know that I can simply take a screenshot after every test and then look at the screenshots of only the failed tests. But this is not the point.
Aucun commentaire:
Enregistrer un commentaire