com.atlassian.webdriver.testing.rule
Class DriverCleanupRule
java.lang.Object
org.junit.rules.TestWatcher
com.atlassian.webdriver.testing.rule.DriverCleanupRule
- All Implemented Interfaces:
- org.junit.rules.TestRule
@ThreadSafe
public class DriverCleanupRule
- extends org.junit.rules.TestWatcher
A class rule that cleans up web drivers from the LifecycleAwareWebDriverGrid
after a specific amount of time elapses since the last test has been run.
Some WebDrivers suffer from bugs that prevent shutdown hooks from cleaning them
up properly. If you need to run your tests using those browsers (e.g. Chrome, IE), use this rule to
make sure the browser will be closed after the test suite finishes.
This rule is only effective if you use it in all your tests as a class rule. If you are using an injection context
(e.g. a TestedProduct with a PageBinder),
make sure this product's life cycle does not exceed this rule's life cycle (which is generally true,
if you use a ProductContextRunner, or just manually instantiate
the produce per test class).
When instantiating the class clients can set a custom timeout, or use default constructor that sets a 3 seconds
timeout.
- Since:
- 2.1
|
Method Summary |
protected void |
finished(org.junit.runner.Description description)
|
protected void |
starting(org.junit.runner.Description description)
|
| Methods inherited from class org.junit.rules.TestWatcher |
apply, failed, skipped, succeeded |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DriverCleanupRule
public DriverCleanupRule(long timeout,
TimeUnit timeUnit)
DriverCleanupRule
public DriverCleanupRule()
starting
protected void starting(org.junit.runner.Description description)
- Overrides:
starting in class org.junit.rules.TestWatcher
finished
protected void finished(org.junit.runner.Description description)
- Overrides:
finished in class org.junit.rules.TestWatcher
Copyright © 2014 Atlassian. All rights reserved.