Running a test from a command line

If you want to run a test without opening the product, you can do so by using the command-line interface.

Before you begin

You must have set the Web Reports preferences in the desktop client to view the status of the test run from the command line. For more information, see Accessing reports remotely.

Procedure

  1. Go to the directory that contains cmdline.bat and cmdline.sh files. On Windows operating systems, this directory is typically found as productInstallationDirectory/cmdline, for example, C:\Program Files\IBM\SDP\cmdline.
  2. Issue the following command:

    cmdline -workspace workspace_full_path -project proj_rel_path -eclipsehome eclipse_full_path -plugins plugin_full_path -suite suite_rel_path -varfile variable_file_full_path -servicename service -serviceargs service_args -configfile file_full_path -results result_file -overwrite {"true" | "false"} -quiet -users nn -vmargs JVM_args -rate RateRunnerGroupName=iterationNumber/duration, iterationNumber/duration -duration Stage1=durationOfStage; Stage2=durationOfStage -exportlog log_full_path -exportstats local_dir_path -exportstatshtml local_dir_path -compare "result_path1, result_path2"-exportstatreportlist stats_list -execsummary local_dir_path-timerange "all, 5 Users, 10 Users"-usercomments "any user comment"

    Note:
    • The workspace is locked after you issue the command. To check the progress of the test during the run, invoke another workspace and open the project through that workspace.
    • On Linux, the command must start with cmdline.sh.
    • The command line does not provide a way to specify the secure storage password for resource monitoring. You must provide the password in the workbench and ensure that it is stored and persisted in the schedule before you execute the schedule from the command line.
    If a value contains spaces, enclose the value in quotation marks. To see the online help for this command, while you are in the directory that contains the .bat file, type cmdline -help.

    The following table explains each option:

    Option Description
    -workspace Required. The complete path to the Eclipse workspace.
    -project Required. The path, including the file name of the project relative to the workspace.
    -eclipsehome Required. The complete path to the directory that contains eclipse.exe.
    -plugins Required. The complete path to the folder that contains the plug-ins. Typically, on Windows operating systems, this folder is located at C:\Program Files\IBM\IBMIMShared\plugins.
    -suite Optional. But, in a command, it is mandatory to use one of the following options:
    • -suite
    • -schedule
    • -aftsuite
    • -servicename
    You must not use the -suite option along with the other options. The path includes the file name of the suite to run relative to the project.

    Starting from 9.2.1.1, you can execute multiple tests simultaneously.

    For example, -suite test1:test2:test3.

    -aftsuite Optional. But, in a command, it is mandatory to use one of the following options.
    • -suite
    • -aftsuite
    • -servicename
    You must not use the -aftsuite option along with the other options. The -aftsuite option accepts aft xml as the parameter value. It supports only one aft xml as input.

    For example, -aftsuite aftinput

    -importzip To import the project as test assets with dependencies into your workspace, use the -importzip option. This command is available from 9.2.1.1 and later.

    Optional. You can execute test assets from the imported zip file, but you must specify the -importzip option along with the -schedule option, or -suite option.

    For example, -importzip script.zip -schedule sch1:sch2:sch3.

    -varfile Optional. The complete path to the XML file that contains the variable name and value pairs.

    To run a Web UI test on a different browser than that was used for the recording, specify the predefined variable as mentioned in this topic.

    -servicename Optional. But, in a command, it is mandatory to use one of the following options.
    • -suite
    • -schedule
    • -aftsuite
    • -servicename
    You must not use the -servicename option along with the other options. The path includes the file name of the service to run relative to the project. Instead of running a performance test, the specified service is run when it is available.
    -serviceargs Optional. The series of arguments to pass to the service specified by the -servicename option. For example, -serviceargs"-myserviceparm1 myserviceparm1value". The values are in quotation marks because they contain spaces.
    -configfile Optional. The complete path to a file that contains the parameters for a test run. Each parameter must be on a single line. To create a configuration file, use an editor that does not wrap lines. Any parameters, whether required or optional, can be set in the configuration file. Command line parameters override the values in this file.
    Note: The file must be in the UTF-8 format. Do not use quotation marks in this file even for values that contain spaces.
    -results Optional. The name of the results file. The default result file is the test name with a time stamp appended. Specify a folder name that is relative to the project to store the test results. For example, -results folder/resultname.
    -overwrite Optional. Determines whether a results file with the same name is overwritten. The default value, false, indicates that the new results file is created. If the value is true, the file is overwritten and retains the same file name. Use double quotes for values "true" or "false".
    -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. To specify the Java™ maximum heap size for the Java process that controls the command line playback, use the -vmargs option with the -Xmx argument. For example, when you use -vmargs -Xmx4096m, specify a maximum heap size of 4096m. This method is similar to specifying -Xmx4096m in the eclipse.ini file for the workbench when playing back the test from the user interface.

    To capture resource monitoring data, use -vmargs "-Drm.collect=true -Drm.collect.interval=numeric value more than 1000".

    To collect the response time data for the app itself and for the server and network and display them in different bar charts, use -vmargs "-De2e.collect=true". For desktop-based web applications, the response time data is captured and displayed by default.

    To execute tests in parallel on all mobile devices, which are in passive mode, connected to the workbench and ready for playback, use -vmargs "-Dall.available.targets.in.parallel=true".

    To execute tests in parallel on all supported desktop browsers and connected mobile devices, use -vmargs "-Dall.available.targets.in.parallel=all".

    To execute tests in parallel on selected desktop browsers and connected mobile devices, use -vmargs "-Dall.available.targets.in.parallel=browser1,browswer2,browser3". Separate browser names with a comma, for example, firefox, ff, chrome, ie, ie64, safari, edge.

    - protocolinput Optional. 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"
    -publish Optional: Use this argument to publish test results to the IBM Rational Test Automation Server. The parameters that you can use with it are as follows:
    • serverURL#project.name=projectName

      If the project name is not specified, the name of the current project is used.

    • no - Use this option if you do not want to publish test results after the run. This option is useful if the workbench Preferences are set to publish the results, however, you do not want to publish them.
    -publish_for Use this option to publish the test results based on the completion status of the tests:
    • ALL - This is the default option. Use this option to publish test results for any text execution verdict.
    • PASS - Use this option to publish test results for the tests that have passed.
    • FAIL - Use this option to publish test results for the tests that have failed.
    • ERROR - Use this option to publish test results for the tests that included errors.
    • INCONCLUSIVE - Use this option to publish test results for the tests that were inconclusive.

    You can add multiple parameters separated by a comma.

    -exportlog Optional. The complete path to a file to store the exported HTTP test log.
    -exportstats Optional. Use this option only when you want to export reports in comma-separated values (CSV) format, with the file name derived from the report name. This directory can be relative to the project or a directory on your file system.If the -exportstatreportlist option is not specified, the reports specified on the Export Reports page of the Performance Test Report preferences are exported.
    -timerange Optional. Use this option along with -exportstats, -exportstatshtml, and -execsummary to export test results within a one or more time ranges. The value is the time range that you specified in the schedule. For example, "all, 5 Users,10 Users". Separate time ranges with a comma and use double quotation marks when there is space in a time range.
    -exportstatshtml Use -exportstatshtml only when you want to export web analytic results. The results are exported in the specified directory. You can then analyze the results on a web browser without using the test workbench.
    -compare Use this argument along with -exportstatshtml and -execsummary to export the result in the compare mode. The value can be paths to the runs and are relative to the workspace. Separate the paths by a comma.
    -exportstatreportlist Optional. A comma-separated list of report IDs. Use this option along with exportstats or exportstatshtml to list the reports that you want to export in place of the default reports or the reports selected in the Preferences (Window > Preferences > Test > Performance Test Reports > Export Reports).

    To export reports with this option, you must specify the report IDs. You can use the Copy ID to clipboard button that is at Window > Preferences > Test > Performance Test Reports > Export Reports to help you to copy the report IDs list on your command line.

    Select your reports by using the multi-selection (not the check box selection) and click the button. Paste the clipboard content on your command line editor

    -execsummary Use this option to export all of the reports for the test run in a printable format, also known as an executive summary, to the local computer. Specify the path to store the executive summary.
    -execsummaryreport Use this option to export a specific report as an executive summary for the test run to the local computer. Specify the ID of the report to export. For example, to export an HTTP performance report, specify http. You must use this option along with -execsummary. To copy the IDs of the reports, click Window > Preferences > Test > Performance Test Reports > Export Reports and in Select reports to export section, select the reports and click Copy ID to clipboard. You can now paste the IDs on your command line.
    -usercomments Optional. Add text within double quotation mark to display it in the User Comments row of the report.
    Note: On Windows, to add comments in a language that might not support Unicode characters, use the CommandLine.exe file to run the command.
    -publishreports To publish test results in Rational Test Automation Server, you can use the -publishreports option. The parameters that you can use with it are as follows:
    • FUNCTIONAL
    • MOBILE_WEBUI
    • STATS
    • TESTLOG
    For example, -publishreports "STATS, TESTLOG".

    Optional. Prefix with “!” to publish all the reports except the specified one.

    For example, -publishreports "! TESTLOG".

    All the reports except the TESTLOG report publish to Rational Test Automation Server after executing the command.

    -stdout Use this option to display the information about the test or schedule on the command line.

    After you run a test or schedule from the command line, the following outputs are displayed to give you the overall information of the test or schedule:

    • --VERDICT - The verdict of the test or schedule.
    • --REMOTE_RESULT - The URL of the result published to Rational Test Automation Server.
    • --REMOTE_RESULT_UI - The URL of the result published to Rational Test Automation Server and can be opened in a browser to analyze the result.
    • --LOCAL_RESULT - The path of the result saved locally.

    For example, -workspace workspace_full_path -project proj_rel_path -schedule sched_rel_path -publish publish_url -stdout

    To stop the test run, you can open another command prompt window and use one of the following options with the cmdline option:
    Command Description
    -stoprun Optional: Stops the test run after the specified number of seconds. Finally, block is executed and the test log is transferred before stopping the run. You must use the -workspace command and specify the location of the workspace.
    -abandonrun Optional: Stops the test run immediately. You must use the -workspace command and specify the location of the workspace.
    Note: Messages are displayed to indicate when the test is launched and when it is completed unless you include the -quiet option.

Example

Note: The configuration file must contain information in option=value pairs. Although paths that contain spaces must be enclosed in quotation marks on the command line, do not enclose spaces in quotation marks in the configuration file. A sample configuration file is as follows:
workspace=D:\My Workspace
eclipsehome=C:\Program Files\IBM\SDP
plugins=C:\Program Files\IBM\IBMIMShared\plugins
project=myProject
schedule=mySchedule.testsuite

What to do next

After you run the test , you may want to export the results for further analysis. For more information, see Exporting report counters automatically.


Feedback