karemo
|
1176
|
1
|
|
|
2
|
|
|
3
|
|
|
4
|
|
|
5
|
|
|
6
|
|
|
7
|
|
|
8
|
|
|
9
|
|
|
10
|
|
|
11
|
|
|
12
|
|
|
13
|
|
|
14
|
|
|
15
|
|
|
16
|
package jdave.webdriver;
|
|
17
|
|
|
18
|
import jdave.Specification;
|
|
19
|
import jdave.junit4.JDaveRunner;
|
|
20
|
|
|
21
|
import org.junit.runner.Description;
|
|
22
|
import org.junit.runner.Runner;
|
|
23
|
import org.junit.runner.notification.RunNotifier;
|
|
24
|
|
|
25
|
|
|
26
|
|
|
27
|
|
|
28
|
public class WebDriverSpecRunner extends Runner {
|
|
29
|
private Runner jDaveRunner;
|
|
30
|
private WebDriverFactory webDriverFactory = new WebDriverFactory();
|
|
31
|
private Browser browser = new Browser();
|
|
32
|
|
|
33
|
public WebDriverSpecRunner(Class<? extends Specification<?>> spec) {
|
|
34
|
jDaveRunner = new JDaveRunner(spec);
|
|
35
|
}
|
|
36
|
|
|
37
|
@Override
|
|
38
|
public Description getDescription() {
|
|
39
|
return jDaveRunner.getDescription();
|
|
40
|
}
|
|
41
|
|
|
42
|
@Override
|
|
43
|
public void run(RunNotifier notifier) {
|
|
44
|
WebDriverHolder.set(webDriverFactory.createFireFoxDriver());
|
karemo
|
1178
|
45
|
try {
|
|
46
|
browser.open();
|
|
47
|
jDaveRunner.run(notifier);
|
|
48
|
} finally {
|
|
49
|
browser.close();
|
|
50
|
}
|
karemo
|
1176
|
51
|
}
|
|
52
|
}
|