1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.springframework.extensions.surf.integration;
20
21 import junit.framework.TestCase;
22
23 import com.thoughtworks.selenium.DefaultSelenium;
24 import com.thoughtworks.selenium.Selenium;
25
26 public abstract class AbstractSeleniumTestCase extends TestCase
27 {
28 protected Selenium selenium;
29
30 protected DefaultSelenium createSeleniumClient(String url) throws Exception
31 {
32 String seleniumBrowser = System.getProperty("selenium.browser", "*safari");
33
34 return new DefaultSelenium("localhost", 4444, seleniumBrowser, url);
35 }
36
37 @Override
38 protected void setUp() throws Exception
39 {
40 String jettyPort = System.getProperty("jetty.port", "8080");
41
42 selenium = createSeleniumClient("http://localhost:" + jettyPort + "/");
43 selenium.start();
44 }
45
46 @Override
47 protected void tearDown() throws Exception
48 {
49 selenium.stop();
50 super.tearDown();
51 }
52 }