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

Feature request: Async verify with timeout #112

Open
jonreid opened this issue Nov 14, 2015 · 1 comment
Open

Feature request: Async verify with timeout #112

jonreid opened this issue Nov 14, 2015 · 1 comment

Comments

@jonreid
Copy link
Owner

jonreid commented Nov 14, 2015

Possibly a new MKTVerificationMode, or possibly verifyWithTimeout

@jonreid jonreid changed the title Async feature: verifyWithTimeout Async testing: verify with timeout Nov 14, 2015
@gchaurais
Copy link

In order to implement this for my project's needs, I created an MKTVerificationMode and followed the same idea of this commit: drodriguez@a77e2e9.

It's basically an infinite while loop that ends when the MKTVerificationData's numberOfMatchingInvocations becomes _wanted or it times out.

After using it in several different tests I identified an interesting problem: this approach doesn't work well with HCArgumentCaptors. HCArgumentCaptor's implementation will basically catch every call to -match for that argument. In this case, there might be multiple attempts to match that argument before we have a fully successful match, so many things will be captured in HCArgumentCaptor's values. The behavior (amount of values captured) will actually be unpredictable and might break some tests as mine did a few times.

I thought I'd mention it just in case you consider including that part of the code or a variation of it too. Make sure you test this scenario.

@jonreid jonreid changed the title Async testing: verify with timeout Feature request: Async verify with timeout May 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants