Let's be honest. As an Apex developer used to provide near-100% test coverage for Apex the same should be true for Lightning components. As we move more code from the server to the client more test need to be written in Javascript. Especially as JS is more error-prone than Apex.
When I listened to Keir Bowden's Dreamforce 2016 talk about Lightning testing with Jasmine and read the docs for the current Lightning Testing Service (Pilot) (usable by everybody) many questions arise:
- Ignore Server actions: As (according to the docs) I am not supposed to invoke Apex actions from JS test, what should I then test?
- Test plumbing or only business logic: Lightning controllers have a lot of code even if they do near to nothing. How do I test all this error prone action calling, attribute reading and setting? And should I really do it with even more test code?
- What to mock?: How much should I use stubbing/mocking/spying to simulate server responses?
- Coverage: When can I be sure to have semantically covered my code well?
- UI testing: Should I use UI-testing (Selenium, Provar) as a third type for real end-to-end testing?
- Integration aspects: If not how can I be sure that JS indeed is triggering the right things in Apex?
and finally...
So the overarching question is:
What to test in Apex and what in Jasmine and how to ensure to cover everything well?