1 package com.atlassian.selenium;
2
3 import junit.framework.TestCase;
4
5
6
7
8
9
10 public abstract class SeleniumTest extends TestCase
11 {
12 protected SeleniumAssertions assertThat;
13 protected SeleniumClient client;
14 protected SeleniumConfiguration config;
15
16 public abstract SeleniumConfiguration getSeleniumConfiguration();
17
18
19
20
21
22
23 public final void setUp() throws Exception
24 {
25 super.setUp();
26 config = getSeleniumConfiguration();
27
28 if (SeleniumStarter.getInstance().isManual())
29 {
30 SeleniumStarter.getInstance().start(config);
31 }
32
33 client = getSeleniumClient();
34
35 assertThat = new SeleniumAssertions(client, config);
36 onSetUp();
37 }
38
39
40
41
42
43
44 protected SeleniumClient getSeleniumClient()
45 {
46 return SeleniumStarter.getInstance().getSeleniumClient(getSeleniumConfiguration());
47 }
48
49
50
51
52 protected void onSetUp() throws Exception
53 {
54 }
55
56
57
58
59
60 public final void tearDown() throws Exception
61 {
62 super.tearDown();
63 onTearDown();
64
65 if (SeleniumStarter.getInstance().isManual())
66 {
67 SeleniumStarter.getInstance().stop();
68 }
69 }
70
71
72
73
74 protected void onTearDown() throws Exception
75 {
76 }
77 }