001// Copyright 2007, 2010, 2013 The Apache Software Foundation
002//
003// Licensed under the Apache License, Version 2.0 (the "License");
004// you may not use this file except in compliance with the License.
005// You may obtain a copy of the License at
006//
007// http://www.apache.org/licenses/LICENSE-2.0
008//
009// Unless required by applicable law or agreed to in writing, software
010// distributed under the License is distributed on an "AS IS" BASIS,
011// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012// See the License for the specific language governing permissions and
013// limitations under the License.
014
015package org.apache.tapestry5.test;
016
017import com.thoughtworks.selenium.CommandProcessor;
018import com.thoughtworks.selenium.Selenium;
019import org.testng.ITestContext;
020import org.testng.xml.XmlTest;
021
022import java.lang.reflect.Method;
023
024/**
025 * Defins {@link ITestContext} attributes meaninful to Tapestry for controlling application startup and shutdown.
026 */
027public class TapestryTestConstants
028{
029
030    /**
031     * {@link ITestContext} attribute holding an instance of {@link Selenium}.
032     *
033     * @see SeleniumTestCase#testStartup(org.testng.ITestContext, org.testng.xml.XmlTest)
034     * @since 5.2.0
035     */
036    public static final String SELENIUM_ATTRIBUTE = "tapestry.selenium";
037
038    /**
039     * {@link ITestContext} attribute holding an instance of {@link ErrorReporter}.
040     *
041     * @see SeleniumTestCase#testStartup(org.testng.ITestContext, org.testng.xml.XmlTest)
042     * @since 5.2.0
043     */
044    public static final String ERROR_REPORTER_ATTRIBUTE = "tapestry.error-reporter";
045
046    /**
047     * {@link ITestContext} attribute holding an instance of {@link ErrorReporter}, used
048     * to shutdown Selenium and the Web Server at the end of the test.
049     *
050     * @since 5.2.2
051     */
052    public static final String SHUTDOWN_ATTRIBUTE = "tapestry.shutdown";
053
054    /**
055     * The {@link ITestContext} attribute holding an instance of {@link CommandProcessor}, with
056     * enhanced exception reporting control. This allows tests that wish to, to bypass the {@link Selenium} interface
057     * and execute commands directly on the Selenium RC server.
058     *
059     * @since 5.2.0
060     */
061    public static final String COMMAND_PROCESSOR_ATTRIBUTE = "tapestry.command-processor";
062
063    /**
064     * {@link ITestContext} attribute holding the application's base URL.
065     *
066     * @since 5.2.0
067     */
068    public static final String BASE_URL_ATTRIBUTE = "tapestry.base-url";
069
070    /**
071     * {@link ITestContext} attribute updated to store the current test method
072     * (as a {@link Method} instance).
073     */
074    public static final String CURRENT_TEST_METHOD_ATTRIBUTE = "tapestry.current-test-method";
075
076    /**
077     * {@link XmlTest} parameter holding an absolute or relative path to a web app
078     * folder.
079     */
080    public static final String WEB_APP_FOLDER_PARAMETER = "tapestry.web-app-folder";
081
082    /**
083     * {@link XmlTest} parameter holding the context path.
084     */
085    public static final String CONTEXT_PATH_PARAMETER = "tapestry.context-path";
086
087    /**
088     * {@link XmlTest} parameter holding the web server port.
089     */
090    public static final String PORT_PARAMETER = "tapestry.port";
091
092    /**
093     * {@link XmlTest} parameter holding the web server ssl port.
094     */
095    public static final String SSL_PORT_PARAMETER = "tapestry.ssl-port";
096
097    /**
098     * {@link XmlTest} parameter holding the browser command to pass to Selenium.
099     */
100    public static final String BROWSER_START_COMMAND_PARAMETER = "tapestry.browser-start-command";
101
102    /**
103     * {@link XmlTest} parameter holding the servlet container to run for the integration tests.
104     *
105     * @since 5.3
106     */
107    public static final String SERVLET_CONTAINER_PARAMETER = "tapestry.servlet-container";
108}