-
Notifications
You must be signed in to change notification settings - Fork 71
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
@RepeatFailedTest #110
@RepeatFailedTest #110
Conversation
I wonder if it would make sense to make I imagine that for @nicolaiparlog, what do you think? |
@jbduncan I think at some point I had proposed the generic idea of |
@smoyer Interesting idea! Seems to me like a long-term goal, though. So I'd suggest that someone approaches this idea as a separate PR in the future. I'd be interested to hear if @nicolaiparlog has any other thoughts or opinions about this idea. :) |
@jbduncan I don't see a way to implement
So the only way I found to do this is to use the test template extension point ( |
@nicolaiparlog Please be sure to tests this with parallel execution enabled. I think the |
@marcphilipp Thanks for pointing that out - I didn't think about parallel execution at all. I also didn't yet look into that feature. Is there any way for a test or test template (besides blocking, which 馃あ) to signal during parallel test execution that it doesn't want to be parallelized? |
|
6396c53
to
8b999dd
Compare
Turned this into a minimal viable feature. Well, almost... logging intermittent test failures is not exactly a core feature but it's already implemented. Once I find a good way to test it, I will document it. Here are my remaining feature ideas:
Before I do that, though, I'm interested to hear from the rest, whether this looks like a worthwhile feature. @sormuras, @marcphilipp, what do you think? |
I think instead of logging intermittent failures, we should wrap them in |
Wow, I didn't know about |
Thank you @marcphilipp, that improved the ease of use and feedback of the feature by a lot. Can you take another look? |
ebb454c
to
2b93c51
Compare
docs/project-page.adoc
Outdated
@@ -1,5 +1,5 @@ | |||
--- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change actually related to the new feature? (it's really hard to see what's changed on that line).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change removes a <p>
tag around the first sentence, but... I'm not sure why, the site seems to be fine as it is. Nevermind, I will remove the change.
import org.junit.jupiter.api.TestTemplate; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
|
||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we're putting the examples and longer documentation in adoc files, the javadocs should probably provide a link to them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #149.
2b93c51
to
4ae0fba
Compare
e5fbeba
to
9432dfc
Compare
return true; | ||
|
||
// if we caught an exception in each repetition, each repetition failed, including the previous one | ||
boolean previousFailed = repetitionsSoFar == exceptionsSoFar; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the case of parallel execution this should block until the previous invocation is done. Alternatively, we could meta-annotate @RepeatFailedTest
with @Execution(SAME_THREAD)
. However, the latter would cause all @RepeatFailedTest
methods in a test class to run sequentially.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think making this extension thread-safe in a way that makes sense and interacts well with Jupiter is not trivial and should be done in a separate issue. My questions:
- should all repetitions be executed in parallel?
- if not, would a block during the traversal of the stream returned by
provideTestTemplateInvocationContexts
not be unexpected for Jupiter?
(While thinking about this, I wanted to write a test that executes @RepeatFailedTest
in parallel. Is there a good way to do that?)
For now, I want to go with @Execution(SAME_THREAD)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, that requires bumping the Jupiter dependency from 5.1.1 to 5.3. I'm okay with that. Does anybody have any qualms about this?
I think this is done. Once @marcphilipp made his review, I will merge. Or he can. :) Proposed commit message:
|
@nicolaiparlog Please see my review above. |
I'd like to bump the dependency on Jupiter from 5.1.1 to 5.3 (reason). Any nays? |
A clear "yay" from my side. 馃槈 |
e074e2b
to
95f7810
Compare
First draft of
@RepeatIfFailedTest
. Code contains lots of TODOs and the test is more of a demo - it needs to be wrapped in the usual Jupiter test engine execution and assertions.Feedback and code is welcome! 馃槂
I hereby agree to the terms of the JUnit Pioneer Contributor License Agreement.