Introduced in Feature Pack 1

Running tests from the command line

You can run test scenarios individually or all at once by using an Ant script. The script generates a report that contains the results of the tests.

Before you begin

  • The store that you want to test is set up
  • Install Java JDK 1.5 or higher, and ensured that the system environment variable JAVA_HOME points to the JDK installation directory.
  • Extract the StorefrontTestAssets.zip package to a directory of your choice, if you do not intend to use the same files as your Eclipse-based environment installation.
  • ; if you have an Eclipse-based environment that is installed, you can follow these instructions. If you do not have an Eclipse-based environment that is installed, you must manually extract the StorefrontTestAssets.zip projects into a directory of your choice and then copy the third-party libraries that are described in that topic by using basic operating system copy commands instead of through Eclipse.
  • .
  • Changed the following properties in the config.properties file to reflect your environment. This file stores the configuration properties for running tests and is in the root of the test bucket project for the store.
    HOSTNAME
    The host name of the store web server.
    STOREURL
    The URL to the root of the store you are testing.
    BROWSER
    ADMIN_USER_NAME
    The site administrator user name.
    ALLOW_MODIFY_CHANGE_FLOWS
    Determines whether the change flow options can be changed in a test (true) or not (false).

About this task

You can run tests by using the following modes:
Batch test execution
Since the results of each test execution are archived, you can easily run the same script multiple times with different test cases specified in the build.properties file.
Custom test bucket execution

Procedure

  • Feature Pack 1Complete the following steps to run tests from the command line.
    Note: To set up this environment, you need the Eclipse-based environment that is used for .
    OptionDescription
    Set up the development environment to run batch mode
    Configure the batch mode properties
    Note: This step is necessary only if you want to change the batch mode settings.
    Go to the build directory at the root of your test bucket project. To change the build settings, open the build.properties file, update the variables, and save the file.
    Run a batch of automation scripts
    1. Open the Start menu and select Run. Type cmd and click OK. A Windows command prompt session is started.
    2. Type ant and press Enter. The target directory is created in the test bucket project. Inside the target folder, the file /doc/test-html-report/index.html is created.
    3. Open the index.html file to view the test report in your default browser.
  • Introduced in Feature Pack 2Complete the following steps to execute tests from the command-line.
    1. Go to the directory of the test bucket project that you want to run. For example, for the Deprecated featureMadisons starter store, enter: Madisons-Tests
    2. Go to the Ant subdirectory. For example, enter: Madisons-Tests/ant
    3. If you do not want to run all of the tests, edit the build.properties file to change the value of the test.include property to the specific test that you want to run.
      For example:
      test.include=**/FSTOREB2C_00.class
      The build.properties file contains several other properties that detail the location of the output, Java build parameters, and test parameters. Although it is recommended that you leave these properties at their default settings, comments are provided to help you determine customized values.
    4. In the Ant subdirectory, type ant to run the tests.
      The build.xml script in this subdirectory is configured to run the specified tests as the default action.
    The test runs; the specified Web browser opens, closes, and moves from page to page according to the test. Once the test completes, the Ant script stops and you are returned to the command prompt.

Results

The results of a set of tests are stored in the test archive folder. By default, this folder is in the target/doc/archive subdirectory of the project. This folder contains one or more timestamped directories that represent the different test runs.

The test report includes a Packages section that displays the name of the test bucket and a Classes section that lists the test scenarios that make up the test bucket. Four test characteristics are also summarized in the report.
Failures and Errors
Cause the test to fail. Clicking the number links to a page that displays the test scenario and the corresponding test bucket that caused the failure or error. Details are also provided to help correct the issue.
Success rate
The percentage of automation scripts that passed.
Total run time
The total amount of time (in seconds) for all the automation scripts to run.

The detailed report that is generated in batch mode simplifies the process of locating and correcting failures in your automation scripts. For each test scenario, the report lists the four main characteristics, a timestamp of when it completed, and the host name of the virtual machine that ran it.