Our team is setting up some tests for our AEM code using theTeleporterRule documented at "Apache Sling :: JUnit server-side testing support bundles". Our goal currently is to make it easy to set up a test that is able to set the JCR up with specific data, which allows us to make in-depth assertions about service output. We've managed to get tests mostly up and running, but are having trouble sorting out the withResources method. Based on my read of the docs, withResources appears to be intended to provide a mechanism for populating the JCR with data prior to tests being run.
Assuming I construct my test rule like so:
public final TeleporterRule teleporter = TeleporterRule.forClass(getClass()).withResources("/test/");
1. Where in the package will the TeleporterRule look when it attempts to load resources from "/test/"? 2. Is there any additional setup needed to get this to work, i.e. adding a filter rule to the package?
3. Does the TeleporterRule automatically clean up any resources that were created in the withResources step?
Thanks for the quick reply, and while this is a great tutorial for doing unit testing it specifically mentions that it isn't designed to help with integration testing. Our service code leverages the caravan library to bind service output to JAX-RS style endpoints, and we really want to perform integration tests to insure the services work properly each time new code is merged. There are a number of tools for doing this, but Sling's TeleporterRule seemed like the most promising as it allows you to effectively write your integration tests in the same way we write our unit tests.