SFRA Testing Technologies

Include integration, unit, and functional tests in your SFRA development process.

Supported testing technologies include these kinds of tests:

  • Controllers are tested with integration tests. Salesforce B2C Commerce uses mocha, chai, and request-promise for integration testing.
  • Models are tested with unit tests. B2C Commerce uses mocha, chai, sinon, and proxyquire for unit tests.
  • Views are tested with functional tests. B2C Commerce uses mocha, chai, and webdriver.io for functional tests.

Testing Commands

Use these commands:

Command Description
npm run cover Runs unit tests with a coverage report.
npm run test * Runs all SFRA unit tests.
npm run test:appium * Runs functional tests for mobile devices.
npm run test:integration * Runs the integration tests.
npm run test:functional Runs the functional tests in the browser.
npm run test:functional:docker Runs the functional tests from inside docker.
npm run test:functional:sauce Runs the remote functional tests

note: - These commands require a dw.json file or extra command-line parameters.