Google is committed to advancing racial equity for Black communities. See how.

Handling log files from a Result Reporter

In some cases, having access to only the test results is not enough; having the log files is necessary to complete the overall results.

Log interface

Any result reporter or test event can have access to the logs by implementing ILogSaverListener, which allows a reporter to receive the logs through different callbacks:

  • testLogSaved: Called right away when a file is logged. This notifies a new file has been logged. This is called at any time.
  • logAssociation: Called in order with the test events. This ensures strong association between the file being logged and the events in progress.

By implementing this interface, the result reporter can have access to the logged file references and use them.

When to use logAssociation

logAssociation is a slightly more complicated event as it relies on the context of the events to be properly interpreted. For example, if the testStart has been called, the log from logAssociation belongs to the test case in progress.

This strong association allows correct placement of logs.