Integration With Selenium - Overview

Applies to TestComplete 15.64, last modified on June 12, 2024

Selenium is a free testing tool for web applications. Using the Selenium WebDriver API, you can create web tests in any programming language.

You can include your Selenium WebDriver tests into your TestComplete test project, run them as part of your automated testing process and analyze test results.

Supported Selenium Tests

TestComplete supports Selenium WebDriver tests created in one of the following unit testing frameworks:

  • JUnit

  • TestNG

  • NUnit

  • PyUnit

  • Ruby Test::Unit

  • PHPUnit

TestComplete does not support Selenium scripts created with Selenium IDE.

Preparing TestComplete for Integration With Selenium Tests

Before you add and run your Selenium tests to TestComplete test projects, you need to prepare TestComplete and your test project. See the following topic for complete information:

Integration With Selenium - Prerequisites

General Procedure

To manage Selenium WebDriver tests in TestComplete, you use the Selenium or Unit Testing project item. It is a collection of various “unit tests” supported by TestComplete: JUnit, TestNG, PHPUnit, PyUnit and others.

In general, you run your Selenium tests from TestComplete in the following way:

  1. You create Selenium tests with one of the supported unit testing frameworks (see above).

  2. In TestComplete, add a Selenium or Unit Testing collection to your project.

    Also, add the appropriate unit testing item. For example, if you have a Selenium test created with JUnit, add a JUnit project item:

    Selenium testing in TestComplete: Adding unit testing item to your project
  3. Configure the project item to run your Selenium test:

    Selenium testing in TestComplete: Configure the Item to Run Your Selenium Test

    For information on configuration settings, see the topics of the Running Selenium Tests in TestComplete section.

  4. Run the project item in TestComplete in the same way as you run other unit tests: from the TestComplete UI, from a keyword test or script code, or make it part of the project test run. See Running Unit Tests.)

See Running Selenium Tests in TestComplete for detailed instructions on creating and configuring TestComplete project items for various Selenium tests.

Controlling Selenium Server

If you use the Selenium Server, you must have the server running before you run your Selenium tests in TestComplete.

If you have Selenium tests created with PHPUnit, you must have the Selenium Server running to run these tests in TestComplete.

You can configure TestComplete to run your Selenium Server automatically when the testing starts. For information on how to do this, see Integration With Selenium - Prerequisites.

When you start a test in TestComplete, TestComplete will run the server. During the test run, TestComplete will track Selenium Server events and post information on them to the test log.

After the test run is over, TestComplete will stop the server.

Note that currently TestComplete does not support handlers creation for server events it posts to the test log.

Analyzing Selenium Test Results

After the test run is over, TestComplete will show results of Selenium tests in the test log. Here is a sample output:

Selenium Test Results

If the unit testing framework you used to run Selenium tests reports that all the tests passed, TestComplete posts a success message to the test log. Otherwise, it posts an error message.

The command-line output that the testing framework produced is visible in the Details tab of the test log, when you select the message.

If you configure TestComplete to trace Selenium Server events during the testing, TestComplete will also log information on all server events. Below is a sample view of the test log with such events:

Selenium Server Events

See Also

Integration With Selenium
Working With TestComplete

Highlight search results