Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scope LENIENT/Silent mode to methods, not entire classes #1764

Open
jimshowalter opened this issue Aug 21, 2019 · 0 comments
Open

Scope LENIENT/Silent mode to methods, not entire classes #1764

jimshowalter opened this issue Aug 21, 2019 · 0 comments

Comments

@jimshowalter
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant