KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > testsupport > SeleniumTestSupport


1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  */

19
20 package org.apache.geronimo.testsupport;
21
22 import com.thoughtworks.selenium.Selenium;
23
24 import org.openqa.selenium.server.SeleniumServer;
25
26 import org.testng.annotations.BeforeSuite;
27 import org.testng.annotations.AfterSuite;
28
29 /**
30  * ???
31  *
32  * @version $Rev: 484700 $ $Date: 2006-12-08 14:14:25 -0500 (Fri, 08 Dec 2006) $
33  */

34 public class SeleniumTestSupport
35     extends TestSupport
36 {
37     protected static ExtendedSelenium selenium;
38     
39     protected ExtendedSelenium createSeleniumClient(String JavaDoc url) throws Exception JavaDoc {
40         super.setUp();
41         
42         if (url == null) {
43             url = "http://localhost:" + SeleniumServer.DEFAULT_PORT;
44         }
45         
46         log.info("Creating Selenium client for URL: " + url);
47         
48         ExtendedSelenium selenium = new ExtendedSelenium(
49             "localhost", SeleniumServer.DEFAULT_PORT, "*firefox", url);
50         
51         return selenium;
52     }
53     
54     @BeforeSuite
55     protected void startSeleniumClient() throws Exception JavaDoc {
56         log.info("Starting Selenium client");
57         
58         selenium = createSeleniumClient("http://localhost:8080/");
59         selenium.start();
60     }
61     
62     @AfterSuite
63     protected void stopSeleniumClient() throws Exception JavaDoc {
64         log.info("Stopping Selenium client");
65         
66         selenium.stop();
67     }
68
69     /**
70      * junit's per class setup.
71      *
72     protected void setUp() throws Exception {
73         log.info("Starting Selenium client");
74         
75         selenium = createSeleniumClient("http://localhost:8080/");
76         selenium.start();
77     }
78      */

79     
80     /**
81      * junit's per class teardown.
82      *
83     protected void tearDown() throws Exception {
84         log.info("Stopping Selenium client");
85         
86         selenium.stop();
87     }
88      */

89 }
90
91
Popular Tags