0
votes

I'm trying to execute a JUnit test remotely on an Adobe AEM instance, using the JUnit Servlet. Post for reference: Which Testing framework will suit for Adobe CQ5 Project?

I've defined my testcase and was expecting to be able to see it at this URL

http://localhost:4502/system/sling/junit/

It does not show up though.

The test runs correctly with mvn test.

it's a very simple test case (junit3):

import junit.framework.TestCase;
 public class mySampleTest extends TestCase {
    public void testSomething(){
        return;
    }
}

What do I need to do in order for the testcase to be available in the Sling remote JUnit test servlet?

1
I got a little bit further, I've noticed I had to add the Sling-Test-Regexp tag to my pom. <Sling-Test-Regexp>.*</Sling-Test-Regexp> Now it shows all the classes but not those that contain the tests. - mish
Ok, it was indeed that. I set the Sling-Test-Regexp to .*Test and it shows only the classes ending with "Test" (as expected). Now I have to figure out why the classes in /src/main/test/ are ignored. - mish

1 Answers

1
votes

I think you need to add annotation @RunWith(SlingRemoteTestRunner.class). Also you should read about it here and you can see example here