CQ - Writing Server Side JUnit Tests

I am trying to write a JUnit test case for one of my Java classes that creates a page with some properties set in CQ. To do this, he needs to get a link to SlingRepository and ResourceResolverFactory. I used this one to get an idea of ​​how to achieve this. The document says that to run tests on the server side, POST is used for the "http: // $ HOST: $ PORT / system / sling / junit /" path. But in CQ, I get 404 error for this path.

Is there an alternate URL in CQ for this? Or would it really be appreciated if anyone could suggest a better approach?

thank

+1
source share
1 answer

One approach is to use the Sling test runner to run JUnit tests through a browser. This is the approach you are talking about. We had to first install the code in this JAR ( org.apache.sling.junit.core ) in order to add code that allows the URL you provided to work. Once this code exists, this URL will allow you to run tests using the test runner built into the page to run / display the tests:http://localhost:4502/system/sling/junit/). , - Intellij IDE Java- CQ JUnit, IDE JUnit. Eclipse. , IDE .

, / CQ, SlingRepository ResourceResolverFactory, - , , Resource, ResourceResolver, Node . CQ (http://helpx.adobe.com/experience-manager/kb/HowToUseCQ5AsMavenRepository.html), CQ Maven. CQ JAR, Java, , , CQ.

, - - Intellij IDE. IDE, , CQ, , Java ( , , , , ..). Sling test runner, .

:

  • CQ Maven - - Maven .
  • script , , .
  • CQ JAR - - CQ Java.
+4

Source: https://habr.com/ru/post/1656625/


All Articles