Member-only story

Self-Logging Selenium WebDriver Tests

Alex Siminiuc
13 min readNov 2, 2019

--

Photo by Markus Spiske on Unsplash

One of the characteristics of a good Selenium test automation project is the ability of troubleshooting quickly potential problems.

This means finding fast

  • the method (or assertion) that caused the issue
  • what happened before the code execution stopped
  • what is the last visited web page
  • what are the exception details.

The method that caused the issue is visible in the stack trace generated when an assertion fails or an unexpected exception is thrown.

Stack trace shows also the name of the failed test and all methods that lead to the failed method.

Screenshots help seeing the page where the execution stopped.

In addition to all these details, it is useful to have a log that shows everything that the automated test did from the moment it started until it stopped.

Which brings us to logs.

There are multiple types of logs that can be used in a Selenium project.

  • Selenium Logs
  • Exception Logs
  • Test Execution Logs

I will cover the Selenium and exception logs in other posts.

--

--

Alex Siminiuc
Alex Siminiuc

No responses yet