Expand my Community achievements bar.

How to create Test driven development(TDD) for AEM components. Is there any framework to do that in AEM?

Avatar

Level 4

How to create Test driven development(TDD) for AEM components. Is there any framework to do that in AEM?

I need to write junit test cases for components in AEM. Please explain me in detail.

Any help would be appreciated.

 

Thanks 

Mini

3 Replies

Avatar

Level 10

I recommend reading the Sling docs on this subject:

http://sling.apache.org/documentation/development/sling-testing-tools.html

I hope this points you in the right direction... 

Avatar

Level 3

I have got the same problem here. Testing in AEM.

First of all, unit tests in Java are obvious and explored well in last, at least, 10 years. Testing those: models, servlets and such is easy (at unit scope of course).

However, its getting nasty when you want to test component scope (so that  you want to test 1. component rendering 2. dialog 3. design rules). There is a thing called Hobbes.js that is testing well single component (its just a JS code that is ran within editor (or developer I can't recall) mode). However, to easily prove that component as a whole can be inserted into a specific paragraph, can be controller by some post sling servlet business rules - it seems to be quite hard. You have to use some kind of Selenium testing for it - which take too much time and its too unstable to do it in TDD matter. Its even harder to measure code coverage then.

Basically I am asking same thing as minisanu here - is anybody doing TDD for application (that can cover all test cases, control whole environment well) in AEM? I am not a newbie in AEM but didn't see a good tool to do that so far.