You can use the JUnit (Selenium) Test Agent to automate running of both Selenium JUnit tests and ordinary JUnit 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 JUnit test to a Test Library test. Use the same procedure to assign an ordinary JUnit unit test to a test.
1. Configure the Test Agent
On the test host that will run the test, do the following:
-
Launch the Test Agent Settings tool in Start > All Programs > SmartBear > TestAgent > Test Agent Settings.
-
Click Advanced Settings.
-
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 junit-n.nn.jar file location.
Tip: 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 JUnit are located.
-
Make a note of where the test files or archive (zip) file resides.
You can place the test files (or the ZIP file that contains the test files) in a local folder on the test host where the tests will run or in a shared network folder. Alternatively, you can upload the archive file 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 Selenium WebDriver test
-
On the Automations tab, click Add New to add an automated test.
-
In the Agent drop-down list, select JUnit (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 Selenium WebDriver test files are located or to the archive (.zip) that contains the test files.
Below are examples of possible paths:
Value Description C:\MyJUnitTests\
-- or --
file:///C:\MyJUNitTests\A local folder on the test host where tests are located. C:\MyJUnitTests\MyJUnitTest.zip
-- or --
file:///C:\MyJUnitTests\MyJUnitTest.zipThe 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\MyJUnitTest.zip
-- or --
file:///Tests-PC\SharedFolder\MyJUnitTest.zipThe archive (ZIP) file that contains the tests and is located in a shared network folder. http://downloads/mytests.com/MyJUnitTest.zip A website URL path to the archive (ZIP) file that contains the 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) from 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 Selenium test by using Maven, select Use Maven Project.
-
Enter the test case class name in the Test Class field.
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.