sling server side testing | Community
Skip to main content
October 16, 2015
Solved

sling server side testing

  • October 16, 2015
  • 2 replies
  • 590 views

I am trying to run server side unit testing as advised in the advance developer guide.

I am able to see my Test class under the URL" http://localhost:4502/system/sling/junit/tset.com.test.TestableClassTest.html

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by joerghoh

Hi,

Have you used the annotation "@TestReference" instead of the "@Reference" annotation in your unittests? Can you provide the sourcecode for your test class?

kind regards,
Jörg

2 replies

Lokesh_Shivalingaiah
New Participant
October 16, 2015

instead of using annotation @reference to inject the repository, use BundleContext and that should work. refer [1]

[1] bundleContext.getServiceReference(ResourceResolverFactory.class.getName());

joerghoh
joerghohAccepted solution
Employee
October 16, 2015

Hi,

Have you used the annotation "@TestReference" instead of the "@Reference" annotation in your unittests? Can you provide the sourcecode for your test class?

kind regards,
Jörg