By scrolling through the Lightning Reference, I've found that there's an Aura Javascript API class called Test. You can find the API docs at https://na24.lightning.force.com/auradocs/reference.app#reference?topic=api:Test.

The docs are...sparse to say the least. The documentation for the Aura open source framework seems to say you can create a MyComponentTest.js file in your component bundle with tests, but no tool I can find successfully deploys a test class to Salesforce.

Is there a way to write test classes into my Controller that are called when certain events fire? Or are we stuck waiting for Salesforce to support this aspect of Aura?

2 Answers 2


This functionality has not been exposed yet. The Aura framework supports it just fine, but getting that wired into the Dev Tools for Lightning in Salesforce is a bit more involved.

  • 1
    That's what I get for being an early adopter! Commented Jul 4, 2015 at 19:06
  • 1
    Besides being awesome that is.
    – Kris Gray
    Commented Jul 4, 2015 at 20:13
  • @KrisGray is there any way to create a hybrid development environment that uses a client-side installation of the framework for unit testing while still saving the main resources in the component bundle to Salesforce?
    – abd3721
    Commented Oct 14, 2015 at 12:42
  • Yes and no. Aura is open source, and you can setup an instance of it to test with. But you'd have to manually copy over everything after that. See this link for more info on setting it up if you want. developer.salesforce.com/blogs/developer-relations/2015/06/…
    – Kris Gray
    Commented Oct 14, 2015 at 20:13
  • 1
    @KrisGray Has there been any update on this? When can we expect official support for unit testing Lightning? Commented May 4, 2016 at 3:27

I needed a solution for this so I built https://github.com/stevebuik/greased Let me know what you think.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .