Elastic Path Commerce Development

Extending Tests in Commerce Manager

Extending Tests in Commerce Manager

  1. Ensure that the system-tests module is built for Commerce Manager and Cortex:
    • To build the system tests in Cortex, navigate to the extensions/cortex/system-tests module and run the following command:
       mvn clean install -DskipAllTests
    • To build the system tests in Commerce Manager, navigate to the extensions/cm/ext-cm-modules/system-tests module and run the following command:
       mvn clean install -DskipAllTests

    The latest browser driver is automatically downloaded.

  2. Update the extensions/cm/ext-cm-modules/ext-system-tests/selenium/src/test/resources/RepositoryMap.xml with the driver version.
  3. 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.

Running the Tests

Ensure that the extensions/cortex/system-tests module and extensions/cm/ext-cm-modules/system-tests module are 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.

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 -Dcucumber.options="--tags @example" 
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.