mirror of
https://github.com/google/nomulus.git
synced 2025-06-09 22:14:45 +02:00
Use reflection to inject the attempt number
This CL is to address the public static field in RepeatableRunner for caller to get the current attempt number. We tried to have a JUnit TestRule to achieve the purpose but it ended up with having a RuleChain in each class where we already have multiple rules and need to add the retry rule. This is because we have to make sure the retry rule is the last one to wrap the test statement so that the actual retry can include the actions defined in other rules. Having a rule chain is not scalable and confuses engineer so we gave it up. Instead, we decided to expand the current RepeatableRunner to use reflection to inject the attempt number to the test class. Doing it this way can reduce the burden from the caller and it also gets rid of the global state from the previous public static field. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=240789045
This commit is contained in:
parent
308d5eb76b
commit
c8aa6005f2
9 changed files with 132 additions and 45 deletions
|
@ -21,6 +21,7 @@ import com.googlecode.objectify.ObjectifyFilter;
|
|||
import google.registry.model.ofy.OfyFilter;
|
||||
import google.registry.module.frontend.FrontendServlet;
|
||||
import google.registry.server.RegistryTestServer;
|
||||
import google.registry.webdriver.RepeatableRunner.AttemptNumber;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
@ -40,7 +41,8 @@ public class OteSetupConsoleScreenshotTest {
|
|||
.setEmail("Marla.Singer@google.com")
|
||||
.build();
|
||||
|
||||
@Rule public final WebDriverRule driver = new WebDriverRule();
|
||||
private final AttemptNumber attemptNumber = new AttemptNumber();
|
||||
@Rule public final WebDriverRule driver = new WebDriverRule(attemptNumber);
|
||||
|
||||
@Test
|
||||
public void get_owner_fails() throws Throwable {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue