Hi Anil,

On Tue, Mar 20, 2012 at 8:25 AM, Ali Anil Sinaci <[email protected]> wrote:
> ...Let me describe myself. I have a number of unit test classes in which there
> are "org.apache.sling.junit.annotations.TestReference" annotations. These
> classes has @RunWith(SlingAnnotationsTestRunner.class) annotations also. I
> want to execute these tests within the maven process during a complete build
> of Stanbol...

Ok, so that does match the examples at [1],

> ...Is "sending HTTP requests to these classes" the only way to execute these
> unit tests?..

HTTP requests are actually sent to the JUnit servlet that runs
server-side, providing a proxy mechanism to execute tests.

> ...If so, does sending these requests within the integration-tests
> violates any pattern?...

I don't think so - purists might complain that these are integration
tests and not unit tests, but do we care? ;-)

If you can run your tests purely from the HTTP interfaces of your
components I think that's better, as it's a more direct method, easier
to understand, and it's also helpful in documenting those HTTP
interfaces.

OTOH, if you tests need the full OSGi framework, running them via this
proxy mechanism makes a lot of sense to me - they run in the actual
environment where they will be used, so you can be reasonably sure
that you're testing something meaningful.

-Bertrand

[1] [1]  
http://svn.apache.org/repos/asf/sling/trunk/testing/samples/integration-tests

Reply via email to