Testing with Ant

You can use ant to run Web UI and compound tests from the command line. Starting from V2.0 of the ant plugin, you can run multiple tests simultaneously. V6.0 of the ant plugin is supported in HCL OneTest™ UI V10.0.2 of the testing products.

Before you begin

You must have completed the following tasks:
  • Installed IBM® Installation Manager.
    Note: If you are running an earlier version of the ant plugin, you must shut down the product and IBM Installation Manager before starting the test execution. From V2.0 of the ant plugin, shutting down the IBM Installation Manager is no longer necessary before starting the test execution.
  • Installed the products themselves.
  • Verified that you have a test residing within an Eclipse workspace on the computer where the products are installed.
  • Added ant to the PATH environment variable.
Note:

To run Web UI tests on Mac OS, you must add an environment variable that points to the installation directory of the product, for example, export TEST_WORKBENCH_HOME=/opt/HCL/HCLOneTest. For Windows™, this environment variable is already defined.

If you installed the product on Windows by using the stand-alone installer (not using IBM Installation Manager), you must specify the environment variable that points to the installation directory of the product. For example, export TEST_WORKBENCH_HOME=C:\Program Files\HCL\HCLOneTest.

Procedure

  1. Download the ant plugin for the test products from HCL License & Delivery portal on to the computer where the test product is installed.
  2. Extract the following files from the downloaded plugin:
    • HOT-UI-WebUI-Ant-6.0.jar
    • ExecuteWebUIFunctionalTest.xml
    • README.txt
  3. Open the ExecuteWebUIFunctionalTest.xml file and provide parameter values, as shown in the following Web UI example: <webui name="test1" workspace="C:\workspace" projectname="TestProject" suite="Tests/test1.testsuite" results="Results/test1_on_anttask" />
    • To run multiple tests, add additional <webui> tasks and provide details for each test.

    The following table explains each field.

    FieldDescription
    - name Required. The name of the test for the particular test product.
    - workspace Required. The complete path to the Eclipse workspace.
    - projectname Required. The path, including the file name of the project relative to the workspace.
    - suite Required. The path, including the file name of the test to run relative to the project. A test can be a Web UI test, compound test, or an Accelerated Functional Test.
    Note: You must provide the file name along with the file extension if you are using an Accelerated Functional Test suite.
    - varfile Optional. The complete path to the XML file that contains the variable name and value pairs.
    - configfile Optional. The complete path to a file that contains the parameters for a test or schedule run.
    - results Optional. The name of the results file. The default result file is the test or schedule name with a time stamp appended.
    - overwrite Optional. Determines whether a results file with the same name is overwritten. The default value is true, which means the results file can be overwritten.
    - quiet Optional. Turns off any message output from the launcher and returns to the command shell when the run or the attempt is complete.
    - vmargs Optional. Java™ virtual machine arguments to pass in.
    - swapdatasets Optional. For a test, the default value is the dataset specified in the test editor. Overrides the default dataset value to run if required.
    Note: You must use the swapdatasets option to replace dataset values during a test or schedule run. You must ensure that both original and new datasets are in the same workspace and have the same column names. You must also include the path to the dataset. For example: /project_name/ds_path/ds_filename.csv:/project_name/ds_path/new_ds_filename.csv. You can swap multiple datasets that are saved in a different project by adding multiple paths to the dataset separated by a semicolon. For example: /project_name1/ds_path/ds_filename.csv:/project_name1/ds_path/new_ds_filename.csv;/project_name2/ds_path/ds_filename.csv:/project_name2/ds_path/new_ds_filename.csv
    - protocolinput Optional. You can use this argument to run a Web UI test in parallel on different browsers.

    -protocolinput "all.available.targets.in.parallel=all"

    -protocolinput "all.available.targets.in.parallel=chrome,ff,ie"

    Note: If you use the -protocolinput argument, you must not use the equivalent -vmargs arguments:
    -vmargs "-Dall.available.targets.in.parallel=all"
    -vmargs "-Dall.available.targets.in.parallel=browser1,browswer2,browser3"
    - exportstats Optional. The complete path to a directory that can be used to store exported statistical report data.
    - exportstatreportlist Optional. A comma-separated list of absolute paths to custom report format files (.view files) to use when exporting statistical report data with the -exportstats option.
    - exportstatshtml Optional. The complete path to a directory that can be used to export web analytic results. The results are exported in the specified directory. Analyze the results on a web browser without using the test workbench.
    - usercomments Optional. Add text within the double quotation mark to display it in the User Comments row of the report.
    -imsharedloc Optional. The complete path to HCLIMShared location, if it is not at the default location.
  4. Open a command prompt and navigate to the download directory.
  5. Type ant -f ExecuteWebUIFunctionalTest.xml to start test execution.

    When Ant execution completes, a test result is displayed. Ant execution output is logged into the logfile.txt file, and a test log is created in a temp directory under HOT-UI-WebUI-Ant-6.0 from where the ant command is executed.