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

Extending System Tests

Extending System Tests

Prerequisites
  1. Ensure that the system-tests module is built:
    • To build system-tests module, navigate to the /ep-commerce/extensions/cortex/system-tests module and run the following command:
      mvn clean install -DskipAllTests
  2. Ensure that the /ep-commerce/extensions/cortex/system-tests/cucumber/target/com module is set as the test directory in your development environment.
About this task

Elastic Path provides automated tests to ensure the smooth implementation of Cortex when you extend or alter the functionality. These tests ensure that the exiting functionality do not fail when you add new functionality by changing or extending code. Elastic Path recommends configuring tests for extended functionality in a separate module at /ep-commerce/extensions/cortex/ext-system-tests.

Use the following procedure to set up a test extension module in your local development environment:

  1. Add tests and step definitions.
  2. Run against a remote Cortex instance.

Step 1: Adding Tests and Step Definition

  1. In the extensions/cortex/ext-system-tests/cucumber/src/test/resources/features/ directory, create a new directory.
  2. In the new directory, create a .feature file to add the test definitions.
  3. Add the test step definitions in the .feature file.
     Scenario: Search product
        Given I am logged in as a public shopper
        When I search for an item name Alien
        Then the item code is alien_sku

Running Against a Remote Cortex Instance

  1. Navigate to the extensions/cortex/ext-system-tests/ directory and run the following command:
    mvn clean install -Dep.rest.baseurl="http://<REMOTE_SERVER_URL>/cortex
    The <REMOTE_SERVER_URL> specifies the URL of your remote Cortex instance. For example, 9080.
  2. To run a specific test, add the following argument:
    -Dcucumber.options="--tags @example --glue <File Path>"
    You can replace the @example argument with the name of .feature file. For example:
    -Dcucumber.options="--tags @example --glue classpath:com.elasticpath.cortex.dce"