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 for functional tests.

Use these commands:

npm run coverRuns 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:functionalRuns the functional tests in the browser.
npm run test:functional:dockerRuns the functional tests from inside docker.
npm run test:functional:sauceRuns the remote functional tests
  • These commands require a dw.json file or extra command-line parameters.