- summary: Make rMock fail for stupist tests [configurable] --> Make rMock fail for abusive tests [configurable]
When seeing rMock and other mock frameworks in action I
find it quite common that people tend to miss-use the
framework. Instead of driving the design with mocks,
creating a decoupled neat design developers not used to
mocks tend to retrofit the mocks into existing code
somethimes resulting in bizarre setups (and mispleased
users "mocks suck, it is so hard to write all that setup").
It would be nice to be able to configure rMock to
review the tests, introducing "Unacceptable" failures.
A few examples rMock could generate unacceptable
failures for:
* Too many expectations in one test (too many could be
configurable with an intitial value of something like 20).
The message for this failure should hint about the
single responsibility priniple since the class is most
likely doing too much.
* Tests with no asserts, expectations or
expectThatExceptionThrown
This is because of false coverage
* Expectations with to many classes in the stacktrace
between the testMethod to the expectation (this would
be experimental but the rationale would be that when
you are testing with mocks you should test one class at
the time and too many classes in between the
expectation and the test indicates that the setup is
too complicated.