Quick Search:

View

Revision:

Diff

Diff from 1178 to:

Annotations

Annotate by Age | Author | Mixed | None
/fisheye/browse/jdave/trunk/jdave-wicket-webdriver/src/java/jdave/webdriver/WebDriverSpecRunner.java

Annotated File View

karemo
1176
1 /*
2  * Copyright 2008 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
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  * @author Juha Karemo
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 }