my opinion: - always use sling-mock and osgi-mock when it's sufficient for your usecases and you do not hit an area which is no supported by them (only a subset of OSGi and Sling is supported - but for "normale" AEM or sling applications most should be present). it's the fasted way for unit tests.
- always use the fasted resource resolver type [1] and switch only to a more complex one if you need it. - if you hit the limitations of the mock implementation either use teleporter rule or paxexam to use the "real implementations" underneath. i personally did not yet use paxexam, i assume it has less overhead than the teleporter rule. teleporter rule is a bit closer to a "real integration test" and you can combine them with HTTP-bases integration tests. stefan [1] https://sling.apache.org/documentation/development/sling-mock.html#resource-resolver-types >-----Original Message----- >From: Roy Teeuwen [mailto:[email protected]] >Sent: Sunday, December 4, 2016 7:22 PM >To: [email protected] >Subject: PAXExam vs Sling Teleporter (vs Sling Mocks) > >Hello all, > >I have been going through the code base of Apache Sling and it is clear >there are so many ways to test the code, you have two different bundles for >PAX Exam (org.apache.sling.testing.paxexam and >org.apache.sling.paxexam.util), you have the Teleporter and you also have >the Sling Mocks. It makes me wonder in what is the criteria to choose >between these three different ways of testing your code. When would you say >it is enough to use Sling Mocks, where you can even go for a real OAK JCR >based ResourceResolver, or when would you go for PAX Exam or the >Teleporter? What are the benefits of doing your integration tests with >Teleporter vs PAX Exam? > >Thanks for any clarifications! >Greetings, >Roy
