+ Start a Discussion
Jonathan ConwayJonathan Conway 

Unit testing in Lightning

Is it possible to unit-test Lightning components?

Theoretically I can't see why, say,  the Controller and Renderer parts of a component couldn't be unit-tested, as they are essentially just collections of Javascript functions. However, to do this with one of the standard testing frameworks (e.g. Jasmine, QUnit) would probably require some extra pre-processing to make those functions callable, as well as mocking Lightning variables (e.g. element, etc params of controller methods).

Is there any plan on the part of the Lightning team to integrate unit-testing into the framework?
Jerome RussJerome Russ

This was answered here: https://developer.salesforce.com/forums/?id=906F0000000B3srIAC

The short answer is: There is a built in test framework in Aura (The Open Source project Lightning is based on). It has not been exposed as part of Lightning though. In the answer I mentioned earlier, there is a link to a Stack Exchange question where a developer at Salesforce mentioned they are working on it but it keeps getting delayed for Security and Performance.