Elastic Path Commerce Development

Extending System Tests

Extending System Tests

  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
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 procedures 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.

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"