Selenium Plugin Legacy - Introduction


Overview

The Selenium Plugin Legacy for SKF currently allows the integration of the following types of java Selenium Tests :

  • Selenium 1

    • jUnit 3-based tests
    • jUnit 4-based tests

Selenium Tests must be included in the test project as java sources, and their non-selenium dependencies (if any) packaged as maven2 dependencies and declared in the squash-ta-mavin-plugin dependencies. The source code and resources are compiled each time before the test is executed. For more details, see the Converters section.

For Selenium 1 tests, you may at your convenience use the included selenium server management system (see Managing your selenium server in ecosystem environment scripts section), or use a selenium server already available in your testing environment.

If you are looking for information on how to import your existing selenium tests, see see the importing legacy tests section.

NB : a running installation of the browser used by your test is of course required on the machine your selenium RC server runs on.



How to use the Selenium Legacy Plugin

In order to be able to use the Selenium Legacy Plugin, you will need to add the following dependency inside your project pom.xml :

...
<plugin>
    <groupId>org.squashtest.ta</groupId>
    <artifactId>squash-ta-maven-plugin</artifactId>
    <version>${project.version}</version>

    <dependencies>
        ...
        <dependency>
            <groupId>org.squashtest.ta.plugin</groupId>
            <artifactId>squash-ta-plugin-selenium-one-legacy</artifactId>
            <version>${project.version}</version>
        </dependency>
        ...
    </dependencies>
    ...
</plugin>
...


Managing your selenium server in ecosystem environment scripts

To launch and kill your selenium server as part of the ecosystem environment management, proceed as follows :

  • In your ecosystem setup.ta script, insert the following code :
LOAD seleniumConf.properties AS seleniumConf.file CONVERT seleniumConf.file TO configuration.selenium AS seleniumConf EXECUTE launch WITH seleniumConf AS seleniumServer
  • In your ecosystem teardown.ta script, insert the following code :
EXECUTE cleanup WITH seleniumServer AS ignoredResource

NB : Remember, resources defined in the ecosystem setup and teardown scripts can only be seen in these scripts, not in test scripts. However, a resource defined in the ecosystem setup script will be seen in the corresponding ecosystem teardown script, as the ‘seleniumServer’ resource above.

  • Create the ‘seleniumConf.properties’ file in your test resources. The minimal content is as follows :

    squashtest.ta.selenium=yes

NB : Any value is accepted as long as this key exists. See the configuration.selenium resource type documentation for useful parameters.



Importing legacy Selenium tests

To import your Selenium tests into your Squash TF test projects, just copy your test source tree (with code AND resources) under a single subdirectory in the ‘squashTA/resources’ directory. For example, if your test source code and resources where under ‘src/test/java’ and ‘src/test/resources’ respectively, you just have to copy the java and test directories in the ‘squashTA/resources/seleniumTests’ subdirectory :

Importing legacy Selenium tests.

Now, you just have to load ‘seleniumTests’ as a resource to use it in your test.