Open mrAtari opened 7 years ago
I wrote an alternative reporter in order to check the provided interface for usability. My header can be included and compiles with VS2013 (has several warnings because of the inline, but doesn't matter)
Imho the actual version of the Reporter's interface forces tight coupling to hippomocks and is not easily extendable. It would be more flexible to use some kind of ReportFailure(msg, at) and call them from HippoMocks. This would reduce the reporter implementation to 3 Methods only.
The key question is, where do you want the message texts to be generated, by HippoMocks or by the reporter. Imho it's easier to make some stardadized texts and parse them afrerwards to whatever format is needed, e.g like CPPUNIT output is formatted in jUnit format and can be easily reused by many tools then.
Please give a hint, if the proposal matches your intention, or not. If you like it, I can finish in this direction.
The idea from the interface is to have the tight coupling. The message texts should be customizable in the generator, specifically to allow for filtering, selection, printing more data or changing the format of printing so as to integrate with an IDE, test environment, test framework, CI system or such.
I intend to have some reporters included specifically for some test frameworks so people can use those for some common use cases - say, using it with GTest or Catch, or with XML or JUnit-compatible output.
For example, in the CallMissing callback you get told which call is missing, so you can use that info to selectively print a subset of the mock repo (such as anything that came before this, other calls on the same mock etc.). In ExpectationExceeded you could inform the user about why the call did not match, which calls it looks like and why those did not match. In NoCallMatches you can inform what calls did not match and why they did not match.
I can see your point about tight coupling; in this case though it's intentional. Is it an idea to split the responsibilities in two - formatting and reporting?
According to the Single Responsibility Principle, formatting and reporting should be splitted. By the way, Catch already includes a bunch of reporters. I would simply reuse CATCH_FAIL() in a HippoCatchReporter implementation then.
This is a collector topic. ( No critic, just my thoughts) ;-)
I had a look at the current implementation and this are my remarks so far: