Announcement: You can find the guides for Commerce 7.5 and later on the new Elastic Path Documentation site. This Developer Center contains the guides for Commerce 6.13.0 through 7.4.1.Visit new site

This version of Elastic Path Commerce is no longer supported or maintained. To upgrade to the latest version, contact your Elastic Path representative.

Extending Tests in Commerce Manager

Extending Tests in Commerce Manager

Prerequisites
  1. Ensure that the core bundles are built before extending Commerce Manager.
  2. Ensure that the system-tests module is built:
    • To build the system tests, navigate to the extensions/cm/ext-cm-modules/system-tests module and run the following command:
       mvn clean install -DskipAllTests
  3. Download the latest browser driver and update the extensions/cm/ext-cm-modules/ext-system-tests/selenium/src/test/resources/RepositoryMap.xml with the driver version.
  4. Update the RepositoryMap.xml with the bash value of the browser driver.
    • To get the bash values, run the openssl sha1 <filename> command.

      The <filename> specifies the <filelocation> in the RepositoryMap.xml file.

Step 1: Running the Tests

Prerequisite

Ensure that the extensions/cm/ext-cm-modules/system-tests module is built. This module builds all dependencies required for the ext-system-tests module to run the automated unit tests. You must define tests for the customizations in ext-system-tests.

  1. To run the test extensions, navigate to the extensions/cm/ext-cm-modules/ext-system-tests directory and run the following command:
    mvn clean install -DSkipAllTests
    You can use the following optional arguments to run a specific test:
    Table 1. Maven Arguments
    Option Description
    -Dcucumber.options="--tags @example" Specifies that you can replace the tag with a tag that you define.
    -Dfailsafe.fork.count="1" Specifies the number of tests that can be run at the same time. The default value is 1. You can change this value depending on number of TestsIT classes.
    -Premote -Dremote.web.driver.url="<REMOTE DRIVER IP>" Specifies that the tests are executed using a remote VM. The remote.web.driver.url attribute specifies the URL of the remote VM. For example, http://<Remote machine's IP>/wd/hub.
    Note: You must set up selenium grid on your system to use this feature. For more information, see Selenium Grid Documentation.
  2. Navigate to the extensions/cm/ext-cm-modules/ext-system-tests/Selenium directory and run the following command again:
    mvn clean install -DSkipAllTests

Step 2: Running Subset of Tests

In the extensions/cm/ext-cm-modules/ext-system-tests/selenium/src/test/java/com/elasticpath/cucumber/ module, right-click a TestsIT class and click Run.
You can create your own local runner class to run your own tagged tests. For example, RunLocalTestsIT.java runs your own tagged tests at local.
Note:
Do not commit the local runner class and tags that are only for the local testing purpose.