Description
The API is currently "backwards". The Reporter
class is designed around how the Runner
class wants to use it, it doesn't really say anything about what the reporter should do, or how to implement one. The details for what the reporter should do are communicated, although not well at all, through the ReporterFactory
typedef. What really needs to happen is for the reporter to listen on various streams from the Engine
, but to know the specific ones you really need to just copy existing reporter behavior. This also means that lots of other irrelevant details from Engine
leak.
We should consider refactoring to a new pattern. Some options that have been discussed:
- Write an interface in terms of the events that the reporter handles. Very roughly something like:
class Reporter { void onTestStarted(...); void onTestSuccess(...); void onTestFailure(...); void onSuiteDone(...); ... }
- Remove
Engine
and create an API in terms of one or more Streams that emit values that might beLiveTest
, or perhaps a new and more limited interface.
Current reporters also read other details from the engine, like the list of "active" tests so some consideration will bee needed about how to expose what is necessary and leave room for enhancement without leaking too many unnecessary details.