LTS
LTS provides a wrapper for Jasmine and Mocha. The code for LTS is open source, so it can be easily tailored to work with other frameworks as well.
The testing service comprises a global $T
object that contains methods to create components, runcallbacks
, fire application events, and destroy components. The code for the$T
API can be found at https://github.com/forcedotcom/LightningTestingService/blob/master/Lightning-component-tests/test/default/staticresources/lts_testutil.resource.
Salesforce recommends that you write and test for the following behaviors in Lightning Components:
Test use case | Description |
DOM rendering | Validates that components are added where and when they should be. |
Component state | Ensures that components respond as expected. |
Server-side callback response | Gets the right response from a call to another service or resource. |
Validation of variables | Validates whether variables that are loaded from external sources are valid. |
Conditional UI rendering | Verifies what users can see. |
Event handling... |