๐ฏ Purpose
In Verisoft framework, we employ JUnit 5's parameter injection mechanism using DriverInjectionExtension. Occasionally, the instantiation of objects (such as WebDriver or VerisoftDriver) may fail due to transient issues like network instability or resource unavailability. To enhance robustness against such intermittent failures, we've integrated a Retry mechanism that attempts to create the object multiple times before ultimately failing.โ
โ๏ธ How It Works
- The Retry mechanism is activated only when specific properties are defined in the
application.propertiesfile. - If these properties are absent, the system defaults to a single attempt without any retries.
- In the event of repeated failures, an exception is thrown, detailing the parameter type that couldn't be resolved.โ
๐ ๏ธ Configuration Parameters
To enable and configure the Retry mechanism, add the following properties to your application.properties file:
driver.retry.attempts=3
driver.retry.delay.ms=1500
driver.retry.attempts: Specifies the total number of attempts (including the initial one).driver.retry.delay.ms: Defines the delay between attempts in milliseconds.โ
Default Behavior
- If
driver.retry.attemptsis not set, the system will attempt to resolve the parameter only once, with no retries. - If
driver.retry.attemptsis set butdriver.retry.delay.msis omitted, the system defaults to a 1500 milliseconds delay between attempts.
๐ Important Notes
- No modifications are required in the test code; the Retry mechanism operates transparently.
- Exceptions thrown due to unresolved parameters will include detailed information, including the parameter type, to facilitate debugging.