Testing with Ant

You can use Ant to run compound tests and Web UI tests from the command-line interface.

Before you begin

You must have completed the following tasks:
  • Installed Installation Manager.

  • Installed Rational® Functional Tester.

  • Verified that you have test assets residing within Rational® Functional Tester.

  • Downloaded the Rational® Functional Tester Web UI Ant plugin RFT-WebUI-Ant-6.0 from the IBM WebSphere, Liberty & DevOps Community portal on to the computer where you install the product.

  • Added Ant to the PATH environment variable.

About this task

To run Web UI tests on Mac OS, you must add an environment variable that points to the installation directory of Rational® Functional Tester.

For example, export TEST_WORKBENCH_HOME=/opt/IBM/SDP.

Note: For Windows and Linux®, the environment variable is set when you install the product.

Procedure

  1. Extract the following files from the downloaded ant plugin:
    • RFT-WebUI-Ant-x.0.jar

      Where, x is the version number of the Ant plugin.

    • ExecuteWebUIFunctionalTest.xml

    • README.txt

  2. Open the ExecuteWebUIFunctionalTest.xml file and provide required parameter values.
    Remember: You must consider the following requirements:
    • Enter the parameter values within the double quotation marks.
    • Ensure that the special characters in the parameter values do not break the validation of the XML file. For example, you must enter the & character as &.
    For example,

    <webui name="test1" workspace="C:\workspace" projectname="TestProject" suite="Tests/test1.testsuite" results="Results/test1_on_anttask" />

    Note: You can add an additional <webui> task and provide the details for each test to run multiple tests simultaneously.

    The following table explains each parameter in detail.

    Parameter Description
    Required
    name The name of the test for the particular test product.
    workspace The complete path to the Eclipse workspace.
    projectname The path, including the file name of the project relative to the workspace.
    suite 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.
    Optional
    configfile The complete path to a file that contains the parameters for a test run.
    exportstatreportlist 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.
    exportstats The complete path to a directory that can be used to store exported statistical report data.
    exportstatshtml 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 Rational® Functional Tester.
    imsharedloc The complete path to IBMIMShared location, if it is not at the default location.
    overwrite Determines whether a result file with the same name is overwritten. The default value is false, which means the result file cannot be overwritten and a new result file is created.
    protocolinput The option 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,browser2,browser3"
    - quiet

    The option to turn off any message output from the launcher and return to the command shell when the run or the attempt is complete.

    results The name of the results file. The default result file is the test name with a time stamp appended.
    swapdatasets For a test, the default value is the dataset specified in the test editor.

    You must use the swapdatasets option to replace dataset values during a test 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 (;).

    usercomments The option to add text within the double quotation mark () to display it in the User Comments row of the report.
    Note:
    • When you run tests by using the double quotation marks ("") for the usercomments parameter, then the User Comments row of a report does not contain double quotation marks.
    • To work around this problem, you must create a command-line config file, and then run the test by using the configfile parameter.
    varfile The complete path to the XML file that contains the variable name and value pairs.
    vmargs To pass Java virtual machine arguments.
  3. Open a command prompt and navigate to the directory where you downloaded the Ant plugin.
    Note:
    You must close Rational® Functional Tester before you run the test.
  4. Enter ant -f ExecuteWebUIFunctionalTest.xml to run the test.

Results

You have run the test by using the Ant plugin.

What to do next

You can view that the Ant execution output is logged into the logfile.txt file, and a test log is created in a temp directory called RFT-WebUI-Ant-x.0 .