Newer Version Available

This content describes an older version of this product. View Latest

Install Lightning Testing Service

You have two ways to install LTS. The simplest way is to use Salesforce CLI. If you're not using Salesforce CLI, you can manually install the unmanaged package.

Use Salesforce CLI to Install Lightning Testing Service

Salesforce CLI includes a one line command for automatically installing the LTS unmanaged package. The Salesforce CLI also allows you to use the sfdx command line tool to perform automated testing as part of your development process, including automated process, such as continuous integration.

  1. If you haven’t already, enable Dev Hub in your org.
  2. Install Salesforce CLI and verify your installation.
  3. Verify that Salesforce CLI plug-in is updated.
    1sfdx update
  4. Log in to your Dev Hub org.
    1sfdx auth:web:login -d
  5. (Optional but highly recommended) Clone the LightningTestingService Github repo, which contains the sample configuration file and more.
  6. Create a scratch org. The following command uses the sample configuration file from the LightningTestingService repo.
    1cd path/to/LightningTestingService
    2sfdx force:org:create -s -f config/project-scratch-def.json -a scratch1

    To customize your scratch org settings with a company name, email address, and so on, edit the configuration file: /LightningTestingService/config/project-scratch-def.json.

    It’s best to perform automated testing in a clean org, created with consistent settings.

  7. Install the LTS package.
    1sfdx force:lightning:test:install

    This command installs the latest version of the LTS package into your default scratch org. See the help for the install command for more options.

After you install Salesforce CLI and LTS, you can run your tests from the command line.

1sfdx force:lightning:test:run -a jasmineTests.app
When you run your tests, you see output in your CLI that tells you that the command line tools are working and connected to your development org.
Jasmine example test app

See the command line help for other useful details.

1sfdx force:lightning:test:run --help

Install Lightning Testing Service as an Unmanaged Package

If you're not using Salesforce CLI, you're missing a lot, but you can still use LTS. Installing the LTS package is just like installing any other unmanaged package.

  1. Log in to your org. We recommend that you use a new DE org for evaluating LTS.
  2. Go to the project Releases page, and click the package installation URL for the latest release.
  3. Authenticate again with the credentials for your DE org.
  4. Follow the normal package installation prompts. We recommend installing the package for admins only.

LTS Package Contents

However you install it, the LTS package includes the following items:

  1. Example test suites
    • Jasmine JavaScript files in archive static resources
    • Mocha JavaScript files in archive static resources
  2. Example components to be tested
    • Components, an Apex class, and a custom label
  3. LTS infrastructure
    • Jasmine framework and wrapper
    • Mocha framework and wrapper
    • LTS test utilities
    • Test runner component
    • Wrapper test app