gojuno/minimock

Add parallel test scenario in README

Closed this issue · 1 comments

Hi, when one executes tests in parallel with t.Parallel(), and does something like: defer mockController.Finish() (similar with Wait(<duration>) ) controller fails to recognize that some of mocks' Expect/Return and other patterns are not used. Without parallel tests, there would be error like: 'Expected to call .GetMock ...'

To fix that, you need to use Cleanup method of testing.T and inside it call whether Finish or Wait.

Could be implemented like in this issue #62

I think it'd be useful to add it in README, as go official docs aren't much informative

Hey @CyganFx

I think the problem here is that you re-use controller for every t.Run instead of creating a new controller for each t.Run which is the correct way to do it.

But I agree that this should be mentioned in the docs.