samples(testing): add retry rule#565
samples(testing): add retry rule#565
Conversation
8510577 to
302d7f7
Compare
Codecov Report
@@ Coverage Diff @@
## master #565 +/- ##
=========================================
Coverage 78.73% 78.73%
Complexity 378 378
=========================================
Files 27 27
Lines 3418 3418
Branches 171 171
=========================================
Hits 2691 2691
Misses 653 653
Partials 74 74 Continue to review full report at Codecov.
|
| import java.lang.annotation.Retention; | ||
| import java.lang.annotation.RetentionPolicy; | ||
|
|
||
| @Retention(RetentionPolicy.RUNTIME) |
There was a problem hiding this comment.
@BenWhitehead could we use the junit rules you wrote here?
There was a problem hiding this comment.
junit5 has a @RepeatedTest annotation if we can upgrade?
There was a problem hiding this comment.
Sorry, let me clarify here :) @BenWhitehead worked on some shared JUnit rules in java-core, wondering if we can make use of them - https://github.com/googleapis/java-core/pull/327/files. @anguillanneuf let me know if these are a good fit for what you're trying to accomplish, otherwise feel free to ignore my suggestion :)
There was a problem hiding this comment.
https://github.com/googleapis/java-core/blob/master/google-cloud-core/src/test/java/com/google/cloud/testing/junit4/MultipleAttemptsRule.java is what I need, but it's in src/test/, is that something I can import?
Do you know if we can use this for testing?
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.7.1</version>
<scope>test</scope>
</dependency>There was a problem hiding this comment.
FWIW, I tried junit5, but the RepeatedTest annotation naively retries even if test succeeds. I reverted my changes.
There was a problem hiding this comment.
We aren't using Junit 5 yet, I don't remember the reason why, ask at Java Samples Office Hours. (I think it's reasonable to upgrade, but it's also a huge effort - perhaps we can just do it one at a time)
|
Warning: This pull request is touching the following templated files:
|
09e6bdc to
a397481
Compare
a397481 to
302d7f7
Compare
Fixes #552
I referenced: https://www.lenar.io/how-to-re-run-failed-tests-junit/
Alternatively, upgrade to← Not super useful because it retries successful runs.junit5and use@RepeatedTest annotation: https://www.swtestacademy.com/junit-5-how-to-repeat-failed-test/Also tried
But unable to
import com.google.cloud.testing.junit4.MultipleAttemptsRule;Turned out that I need
<classifier>tests</classifier>tag.