Selenium: Best way to capture unexpected error?



  • I know how to check values and create tests and do the error handling if something fails, but what I din't found anywhere was the following:

    A test case tests specific things. But what when unexpected errors occurs which arent a covered by a specific check of a test? Is it possible to set something like a "watchdog for error messages" up or is the only way to get this done to create a function which is called after every step?

    I'm using Selenium together with PHP/PHPUnit (but not integrated into the application which I test itself). Any "best practises" or hints to get this done are very welcome.



  • Depending on what testrunner you are using it may have support for multithreading, so you could always create your own watchdog type method that runs on another thread while your test is running, captures all the errors that are written to that specific error message div you mentioned. The concurrent thread would basically loop on the div text and save any text that is put in it, returning that at the end of the test you would have a list of errors that had occurred.



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2