public class DefaultConditionRunner extends Object implements ConditionRunner
RuntimeException when the
condition is not met in the waitFor(Condition) method. More specific
runners are preferred for different testing frameworks. E.g. JUnit tests
would prefer to use JUnitConditionRunner.| 限定符和类型 | 类和说明 |
|---|---|
static class |
DefaultConditionRunner.Log4jMonitor
A Log4j implementation of
DefaultConditionRunner.Monitor. |
static interface |
DefaultConditionRunner.Monitor
A
DefaultConditionRunner.Monitor can be installed in DefaultConditionRunner as an open ended way of
being notified of certain events. |
static class |
DefaultConditionRunner.NoOpMonitor
A no-op implementation of
DefaultConditionRunner.Monitor. |
ConditionRunner.Context| 构造器和说明 |
|---|
DefaultConditionRunner(DefaultConditionRunner.Monitor monitor,
Selenium selenium,
int interval,
int timeout) |
DefaultConditionRunner(DefaultConditionRunner.Monitor monitor,
Selenium selenium,
int initialDelay,
int interval,
int timeout) |
DefaultConditionRunner(Selenium selenium)
Constructs an instance of this class with reasonable defaults.
|
DefaultConditionRunner(Selenium selenium,
int interval,
int timeout)
Constructs an instance of this class with a
DefaultConditionRunner.NoOpMonitor. |
DefaultConditionRunner(Selenium selenium,
int initialDelay,
int interval,
int timeout)
Constructs an instance of this class with a
DefaultConditionRunner.NoOpMonitor. |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
waitFor(Condition condition)
This method will, every so often, evaluate the given
condition's
Condition.isTrue(ConditionRunner.Context) method, until:
it becomes true, in which case it simply returns
a certain amount of time is passed, in which case it fails by throwing an failure exception
tailored to a given test framework -- e.g. |
void |
waitFor(String narrative,
Condition condition)
As above but with an additional 'should' phrase narrative used in the event of the condition
failing to become true
|
public DefaultConditionRunner(DefaultConditionRunner.Monitor monitor, Selenium selenium, int initialDelay, int interval, int timeout)
monitor - the Monitorselenium - the selenium to be passed to the Conditions run from within this runner.initialDelay - (in millis) how long to wait before the initial test of the conditioninterval - (in millis) when waiting for a condition, how long to wait between calls to
Condition.isTrue(com.thoughtworks.selenium.condition.ConditionRunner.Context)timeout - (in millis) when waiting for a condition, how long to wait until we give up.public DefaultConditionRunner(DefaultConditionRunner.Monitor monitor, Selenium selenium, int interval, int timeout)
monitor - the Monitorselenium - the selenium to be passed to the Conditions run from within this runner.interval - (in millis) when waiting for a condition, how long to wait between calls to
Condition.isTrue(com.thoughtworks.selenium.condition.ConditionRunner.Context)timeout - (in millis) when waiting for a condition, how long to wait until we give up.public DefaultConditionRunner(Selenium selenium, int initialDelay, int interval, int timeout)
DefaultConditionRunner.NoOpMonitor.selenium - the selenium to be passed to the Conditions run from within this runner.initialDelay - (in millis) how long to wait before the initial test of the conditioninterval - (in millis) when waiting for a condition, how long to wait between calls to
Condition.isTrue(com.thoughtworks.selenium.condition.ConditionRunner.Context)timeout - (in millis) when waiting for a condition, how long to wait until we give up.DefaultConditionRunner(Monitor, Selenium, int, int)public DefaultConditionRunner(Selenium selenium, int interval, int timeout)
DefaultConditionRunner.NoOpMonitor.selenium - the selenium to be passed to the Conditions run from within this runner.interval - (in millis) when waiting for a condition, how long to wait between calls to
Condition.isTrue(com.thoughtworks.selenium.condition.ConditionRunner.Context)timeout - (in millis) when waiting for a condition, how long to wait until we give up.DefaultConditionRunner(Monitor, Selenium, int, int)public DefaultConditionRunner(Selenium selenium)
selenium - the selenium to be passed to the Conditions run from within this runner.DefaultConditionRunner(Monitor, Selenium, int, int)public void waitFor(Condition condition)
ConditionRunnercondition's
Condition.isTrue(ConditionRunner.Context) method, until:
AssertionFailedError in the
case of JUnit
RuntimeException and
rethrown
How often if "every so often" and how long is the "certain amount of time" is left to the specific implementations of this interface.
waitFor 在接口中 ConditionRunnercondition - conditionpublic void waitFor(String narrative, Condition condition)
ConditionRunnerwaitFor 在接口中 ConditionRunnernarrative - narrativecondition - condition