Assign Selenium TestNG Tests

Applies to QAComplete 14.3, last modified on February 19, 2024

You can use the TestNG (Selenium) Test Agent to automate running of both Selenium TestNG tests and ordinary TestNG unit tests that do not use Selenium modules. The procedure of assigning tests to Test Library tests is the same for both test types.

This instruction demonstrates how to assign a Selenium TestNG test to the Test Library test. Use the same procedure to assign an ordinary TestNG unit test to a test.

1. Configure the Test Agent

On the test host that will run the test:

  • Launch the Test Agent Settings tool in Start > All Programs > SmartBear > TestAgent > Test Agent Settings.

  • Click Advanced Settings.

  • If needed, specify the path to the Java Runtime executable (java.exe). For example, if you have several Java versions installed, specify the path to the Java Runtime version you will use to run tests.

  • Specify the path to the testng-n.n.n.jar file location (you can skip this step if you use Maven to run tests).

2. Prepare your Selenium WebDriver test

  • If needed, zip up the folder where your Selenium WebDriver tests created with TestNG are located.

  • Make a note of where the test files or the archive (zip) file is located.

    You can place the test files or the archive file on a local folder on the test host where the tests will run or in a shared network folder. Alternatively, you can upload the archive to the server (see below).

3. Prepare your Test Library test

  • In the Test Library, open an existing test for the Selenium WebDriver test or add a new test.

  • Select a default host. If you skip this step, after you assign an automated test and click Save, the system will remind you that the test host is missing.

  • Save the changes.

4. Assign the Selenium WebDriver test

  • On the Automation tab, click Add New to add an automated test.

    The Automations tab

    Click the image to enlarge it.

  • In the Agent drop-down list, select TestNG (Selenium).

    Note: If the default host assigned to the test does not support the selected automated testing tool, the test will not run.
  • You can leave the Title field blank, and the system will use the name of the attached Selenium test, or you can enter a meaningful title.

  • The value of the Timeout field tells the test runner how long to let the test run. Enter the timeout value in seconds. If the test takes longer than the given timeout, the test runner will stop running.

  • In Url, UNC or local path, enter the path to the folder where your TestNG test files are located or to the archive (ZIP) file that contains the test files.

    Below are examples of possible path values:

    Value Description
    C:\MyTestNGTests\
    -- or --
    file:///C:\MyTestNGTests\
    A local folder on the test host where tests are located.
    C:\MyJUnitTests\MyTestNGTest.zip
    -- or --
    file:///C:\MyJUnitTests\MyTestNGTest.zip
    The archive (ZIP) file that contains the test files and is located in a local folder on the test host.
    \\Tests-PC\SharedFolder\
    -- or --
    file:///Tests-PC\SharedFolder\
    A shared network folder where tests are located.
    \Tests-PC\SharedFolder\MyTestNGTest.zip
    -- or --
    file:///Tests-PC\SharedFolder\MyTestNGTest.zip
    The archive (ZIP) file that contains the tests and is located in a shared network folder.
    http://downloads/mytests.com/MyTestNGTest.zip A website URL path to the archive (ZIP) file that contains test files.
    Note: If the path you enter is incorrectly formatted, QAComplete will highlight the path in red.

    Alternatively, upload your zipped file using File Attachments. Click Browse and navigate to the zipped test files.

  • In Custom Args, enter additional command-line arguments to pass to the test runner tool that will run your test.

  • The Run Mode drop-down list specifies how the test agent will get your test files and run the test.

    • To copy test files to the test host and run the test in a temporary folder there, choose Copy the test project to and run it in a temporary folder in Run Mode.

    • To run the test directly in the folder where the test files are located, choose Run the test project in place (if possible) in the Run Mode. If the test files are located in a shared network folder or in a local folder on the test host, the test agent will run the test directly in that folder.

  • If you want to run your test by using Maven, select Use Maven Project.

  • Enter the test case class name in Test Class.

    If you use Maven to run tests, you can leave the field empty to run all test cases defined in your Selenium test.

  • Click Submit.

See Also

Assigning Selenium JUnit and JUnit Unit Tests
Assign Selenium NUnit Tests

Highlight search results