Configuring test scripts in Micro Focus ALM

You must configure the test script that you created in Micro Focus Application Lifecycle Management (ALM) to run the Web UI tests.

Before you begin

You must have performed the following tasks:

About this task

You can navigate to the alm directory to copy the content of the template file. The alm directory resides within the installation directory of HCL OneTest UI. The name of the template file is WebUI_ALM_Windows.txt and you can access the file from the following location:

Installation_dir\HCL\HCLOneTest\alm

For example, C:\Program Files\HCL\HCLOneTest\alm

You must provide the values for the following required parameters:
  • Workspace
  • Project
  • TestSuiteName
If you include these required parameters in a configuration file and use the ConfigFile parameter to specify the complete file path, then these parameters are not required.
Important:

You must enter the parameter values within the double quotation marks. If the values of the parameter contain the double quotation marks, then the values must be enclosed in another double quotation marks. For example, if you want to add a label for a test result as "perf mon", then you must enter the parameter value in the script as follows:

Labels = ""perf mon""

Procedure

  1. Log in to the Micro Focus ALM portal, if you are not already logged in.
    The Micro Focus ALM dashboard is displayed.
  2. Expand Testing from the left pane, and then click Test Plan.
  3. Select a test script from the folder that you want to configure.
  4. Click the Test Script tab.
  5. Paste the content of the WebUI_ALM_Windows.txt file that you copied in the space provided in the Test Script tab.
  6. Enter the parameter values that are required for your test run in the script by referring to the following table:
    Parameter Description
    Required
    Workspace Use this parameter to enter the complete path of the Eclipse workspace.
    Project Use this parameter to enter the name of the project that has test assets.
    TestSuiteName Use this parameter to enter the name of the test assets.
    For example,
    Workspace = "C:\Users\HCL\hclonetest\workspace1"
    Project = "proj1"
    TestSuiteName = "Tests/testHttp.testsuite"
    Optional
    ConfigFile Use this parameter to provide the complete path to a configuration file that contains the parameters for a test run.
    ExportReport Use this option to export the unified report of UI tests to the file formats such as PDF, HTML, and XML.
    Note: The exported XML file is a JUnit XML file. You can view this file in applications that support JUnit reporting formats.

    The command syntax is as follows:

    exportReport "type=<reporttype>;format=<file type1,file type2,file type3>;folder<destination folder path>;filename=<name of the exported file>

    For example, to export the report to only the pdf format, you can use

    exportReport "type=unified;format=pdf;folder=Exportedreport102;filename=testreport

    If you want to export the report to multiple formats, you can specify the file formats as comma-separated values. The file type value can be in uppercase or lowercase.

    For example, to export the report to all the supported formats, you can use exportReport "type=unified;format=pdf,xml,html;folder=Exportedreport102;filename=testreport

    The report in different file formats use the same file name that is specified in the command.

    ExportStatReportlist Use this parameter to provide a comma-separated list of absolute paths to custom report format files (.view files) that you can use to export statistical report data with ExportStatsFile.
    ExportStatsFile Use this parameter to provide the complete path to a directory that you can use to store exported statistical report data.
    ExportStatsHtml Use this parameter to provide the complete path to a directory that you can use to export web analytic results. The results are exported to the specified directory. You can analyze the results on a web browser without opening HCL OneTest UI.
    IMSharedLocation Use this parameter to enter the complete path to the HCLIMShared location.
    Labels Use this parameter to add labels to test results when the test run is complete. You can add multiple labels to a test result separated by a comma (,).
    For example,
    Workspace = "C:\Users\HCL\hclonetest\workspace1"
    Project = "proj1"
    TestSuiteName = "Tests/testHttp.testsuite"
    Labels = "label1, label2"

    When you run test assets, then the labels that you added are displayed on the UI Test Statistical Report in HCL OneTest UI.

    The Results page of HCL OneTest Server displays the label that you added in the Labels parameter for the specific test asset in the following condition:
    • When you set Publish result after execution as Always or Prompt in the preferences of HCL OneTest UI (Windows > Preferences > Test > HCL OneTest Server > Results).

    Note:
    • When you run tests by using the double quotation marks ("") for the Labels parameter, then the labels in the test result do not include the 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.
    • When you use the ConfigFile parameter to run tests, then labels provided in the configuration file take precedence over the labels provided in the test script.
    OverwriteResultsFile Set this parameter value to true or false to determine whether a result file with the same name must be overwritten or not.

    The default value is true.

    Publish Use this option to publish test results to HCL OneTest Server from Microfocus ALM.

    You must provide the URL and offline user token of the server in Window > Preferences > Test > HCL One Test Server of HCL OneTest UI before you use the Publish parameter in the test script.

    Use the following arguments with the Publish parameter:

    • To specify the project name, use any of the following formats:
      • serverURL #project.name=projectName&teamspace.name=name_of_the _teamspace

      • serverURL #project.name=projectName&teamspace.alias=name_of_the _teamspace_alias

      You must consider the following points while providing the project name:
      • If the project name is not specified, then the value of the Project parameter is used.

      • If you have a project with the same name in different team spaces, then you can append either the &teamspace.name=name_of_the _teamspace or &teamspace.alias==name_of_the_teamspace_alias options.

        For example:
        Workspace = "C:/Users/IBM/rationalsdp/workspace1"
        Project = "proj1"
        TestSuiteName = "Tests/testHttp.testsuite"
        Publish = "https://localhost:5443#project.name=test&teamspace.name=ts1"
        Where:
        • https://localhost:5443 is the URL of the server.

        • test is the name of the project.

        • ts1 is the name of the team space.

      • If the name of the project or team space contains a special character, then you must replace it with %<Hex_value_of_special_character>.

        For example, if the name of the team space is Initial Team Space, then you must provide it as Intial%20Team%20Space.

        Where, %20 is the hexadecimal value of the space character.

    • To avoid publishing of reports, use no.

      You can use the no option if you do not want to publish test results after the run. This option is useful if the product preferences are set to publish the results, but you do not want to publish them.

      For example:
      Workspace = "C:/Users/IBM/rationalsdp/workspace1"
      Project = "proj1"
      TestSuiteName = "Tests/testHttp.testsuite"
      Publish = "no"

    If you do not use the Config File parameter to run the tests, then the values provided in the test script always take precedence over the Results options set in the product preferences (Window > Preferences > Test > HCL One Test Server > Results).

    The Reports information section on the Output window displays the names of the report along with its corresponding URLs in the following conditions:

    • When you configured the URL of HCL OneTest Server in preferences of HCL OneTest UI (Window > Preferences > Test > HCL One Test Server.

    • When you set Publish result after execution as Always or Prompt in the preferences of HCL OneTest UI (Window > Preferences > Test > HCL One Test Server > Results).

    Publish_for

    Use this parameter to publish test results to HCL OneTest Server from Micro Focus ALM based on the completion status of the tests. You must use the Publish_for parameter along with the Publish parameter.

    The following are the available options that you can use for the Publish_for parameter:

    • ALL - This is the default option. You can use this option to publish test results for any text execution verdict.
    • PASS - You can use this option to publish test results for the tests that have passed.
    • FAIL - You can use this option to publish test results for the tests that have failed.
    • ERROR - You can use this option to publish test results for the tests that included errors.
    • INCONCLUSIVE - You can use this option to publish test results for the inconclusive tests.
    You can add multiple parameters separated by a comma.
    For example:
    Workspace = "C:/Users/IBM/rationalsdp/workspace1"
    Project = "proj1"
    TestSuiteName = "Tests/testHttp.testsuite"
    Publish = "https://localhost:5443#project.name=test&teamspace.name=ts1"
    Publish_for = "FAIL,ERROR"
    
    Publishreports Use this option to publish test results in HCL OneTest Server. The values that you can use with Publishreports are as follows:
    • FT - This is an identifier for Functional Test Report. You can use this value to publish the unified report if it is available for the selected test. See Unified reports.
    • STATS - This is an identifier for Statistics Report. You can use this value to publish the web analytics report if it is available for the selected test. See UI Test Statistical report.
    • TESTLOG - This is an identifier for Test Log. You can use this value to publish the test log if it is available for the selected test. See Logs overview.

    You must use the Publishreports parameter along with the Publish parameter.

    For example:
    Workspace = "C:/Users/IBM/rationalsdp/workspace1"
    Project = "proj1"
    TestSuiteName = "Tests/testHttp.testsuite"
    Publish = "https://localhost:5443#project.name=test&teamspace.name=ts1"
    Publishreports = "STATS, TESTLOG"

    The values specified here override the values selected in Window > Preferences > Test > HCL One Test Server > Results of HCL OneTest UI.

    You can prefix the value with ! to publish the reports except for the specified one in the test script.

    For example,
    Workspace = "C:/Users/IBM/rationalsdp/workspace1"
    Project = "proj1"
    TestSuiteName = "Tests/testHttp.testsuite"
    Publish = "https://localhost:5443#project.name=test&teamspace.name=ts1"
    Publishreports = "!TESTLOG"

    All the reports except the TESTLOG report is published to HCL OneTest Server after executing the command.

    ProtocolInput
    Use this option with additional arguments as follows:
    • 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 option, you must not use the following equivalent VMArgs arguments:
      VMArgs "-Dall.available.targets.in.parallel=all"
      VMArgs "-Dall.available.targets.in.parallel=browser1,browswer2,browser3"
    • To specify the Web UI preferences such as highlighting the page element and capturing screens:

      For example, ProtocolInput = "webui.highlight=<value>;webui.report.screenshots=<value>" where webui.highlight specifies whether the page element must be highlighted and webui.report specifies whether the screens must be captured while playing back the test in the browser.

    Quiet

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

    ResultsFile Use this parameter to provide a different name to the result file.

    The default name of the result file is the name of the test or schedule with a timestamp appended.

    UserComments Use this parameter to display comments that you added in the UserComments row of a report.
    Note:
    • When you run tests by using the double quotation marks ("") for the UserComments parameter, then the UserComments 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 Use this parameter to provide a complete path to the XML file that contains the variable name and value pairs.
    VMArgs Use this parameter to pass Java virtual machine arguments.
  7. Click the Save icon.

Results

You have configured the test script by adding the required parameter values for the test run.

What to do next

You can run test assets from Micro Focus ALM. See Running tests from Micro Focus ALM.