You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It definitely makes sense to worry about mocks that aren't invoked, because that could mean the test writer assumes something is happening that isn't happening, indicating a problem. Uninvoked mocks are probably as serious as missed mocks (things that need to be mocked and aren't).
However, there are many projects (including ours) that have common testing base classes with shared, recurring mocking, and in those cases it's not tractable to have some subclasses get some mocks and other subclasses get other mocks (we tried passing a mess of booleans into the init code, but it was too cumbersome). Or, similarly, there's a test helper that's not a base class, but is shared by composition by N test classes.
In the case of shared mocking, it would be great if we could put a LENIENT annotation just on the method(s) that create the shared mocks. Then the test classes could run without LENIENT, and without using a Silent runner, so unnecessary mocks could be flagged in those classes. Just not flagged in the shared code.
The text was updated successfully, but these errors were encountered:
It definitely makes sense to worry about mocks that aren't invoked, because that could mean the test writer assumes something is happening that isn't happening, indicating a problem. Uninvoked mocks are probably as serious as missed mocks (things that need to be mocked and aren't).
However, there are many projects (including ours) that have common testing base classes with shared, recurring mocking, and in those cases it's not tractable to have some subclasses get some mocks and other subclasses get other mocks (we tried passing a mess of booleans into the init code, but it was too cumbersome). Or, similarly, there's a test helper that's not a base class, but is shared by composition by N test classes.
In the case of shared mocking, it would be great if we could put a LENIENT annotation just on the method(s) that create the shared mocks. Then the test classes could run without LENIENT, and without using a Silent runner, so unnecessary mocks could be flagged in those classes. Just not flagged in the shared code.
The text was updated successfully, but these errors were encountered: