-
Notifications
You must be signed in to change notification settings - Fork 23
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
Add timeout
pre-condition
#74
Comments
Yes.
Dunno; having a play now.
Sounds good.
That would be surprising. Your example where such preconditions are defaults that are applied to atomic children makes intuitive sense to me. |
Thanks Rich. If you fancy a play look at the hooks mechanism. This will work well for I was wondering whether a hook for single One easy way around this would be to say that So I don't think that's expected! |
Looking at this simply, if So, expand Oh boy does this violate the open-closed principle! Because if we came up with another, similar, requirement, we'd have to make two things again. Every time. Ignoring/focusing/tags - perhaps they're special cases. But perhaps other bits of metadata need to be general, or perhaps we bring hooks closer to the action here - have a kind of pre-condition-hook thing where you can propagate a hook down the tree in a way that children can redefine... |
@greghaskins at the moment this timeout implementation only affects the innards of the test and not the before, around, after parts. This is in part an effect of the spectrum error handling, which goes haywire if you stop a test... The hooks for timeout are within the error handling not downstream of it. So the aborted test cannot report errors itself on a separate thread after the test has already failed. |
Questions from Greg
Actually, no. This question made me ponder whether I made the right decision. JUnit's timeout applies to the entirety of the test execution including This could be changed.
Again - it doesn't.
Not applicable.
The hook interrupts the test execution by killing its thread. The hook, at the moment, is buried well within the execution of a low-level Given In some ways, this limited implementation is easy to predict. In other ways, it may violate the POLS. Feel free to express some pseudocode for tests that reveal your own expected behaviour and I'll either add them to the code to show it already does it, or even try to get them to pass. I have some complexish ideas for how to solve the issue of not letting the test report errors after it's timed out... the cure may be worse than the disease! |
My gut feels like time spent in |
Cucumber doesn't natively do timeouts to the best of my knowledge. RSpec and Jasmine don't have a test timeout feature of their own. I think the right thing to do here is extend the test timeout to echo E.g. it("runs ok", () -> {
doSomething();
withTimeout(ofSeconds(10), () -> {
doSomethingElse();
});
}); |
Similar to JUnit's
@Test(timeout=1234)
this is a suggestion to extend the current pre-condition functionality a bit like this:This is quite easy to do, since the
PreConditionBlock
can just handle it for us, wrapping the real block in a timing out sentinel. But there's a wrinkle. What does:If we think it means that the whole parent block runs within a timeout, then the behaviour would happen for free. I think that's the least valuable and least expected answer. More likely it means that the above is the equivalent of:
Thoughts on:
PreConditions
a good approach?The text was updated successfully, but these errors were encountered: