Test Extensions in Commerce Manager
Elastic Path provides automated tests to ensure the smooth implementation of Self-Managed Commerce Manager when you extend or alter the functionality. These tests ensure that the existing functionalities do not fail when you add new functionalities by changing or extending code. Elastic Path recommends configuring tests for extended functionality in a separate module at extensions/cm/ext-cm-modules/ext-system-tests.
Use this procedure to set up extension tests in your local development environment.
- Complete the prerequisite tasks.
- Run the test extensions.
- Run the subset of test extensions.
Extending Tests in Commerce Manager
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-testsmodule and run the following command:mvn clean install -DskipAllTestsTo 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 -DskipAllTestsThe latest browser driver is automatically downloaded.
Update the
extensions/cm/ext-cm-modules/ext-system-tests/selenium/src/test/resources/RepositoryMap.xmlwith the driver version.Update the
RepositoryMap.xmlwith the bash value of the browser driver.To get the bash values, run the
openssl sha1 <filename>command. The<filename>specifies the<filelocation>in theRepositoryMap.xmlfile.
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:
-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 ofTestsITclasses.-Premote -Dremote.web.driver.url="<REMOTE DRIVER IP>"Specifies that the tests are executed using a remote VM. The
remote.web.driver.urlattribute specifies the URL of the remote VM. For example,http://<Remote machine's IP>/wd/hub.You must set up selenium grid on your system to use this feature. For more information, see Selenium Grid Documentation