sling-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bertrand Delacretaz (JIRA)" <>
Subject [jira] Commented: (SLING-1963) Support for server-side JUnit tests, injected in a running Sling instance
Date Thu, 03 Feb 2011 07:55:28 GMT


Bertrand Delacretaz commented on SLING-1963:

Here's the scenario for playing with this extension, in case someone wants to try it:

1) Start a Sling launchpad standalone instance:
  cd launchpad/builder
  rm -rf sling (to get rid of old data if needed)
  java -jar target/

2) Install the junit bundles:
  cd whiteboard/bdelacretaz/junit
  mvn -P autoInstallBundle clean install -Dsling.url=http://localhost:8080/system/console

3) Go to http://localhost:8080/system/sling/junit
  The servlet should execute tests from the testbundle and explain how to create scriptable

> Support for server-side JUnit tests, injected in a running Sling instance
> -------------------------------------------------------------------------
>                 Key: SLING-1963
>                 URL:
>             Project: Sling
>          Issue Type: Improvement
>            Reporter: Bertrand Delacretaz
>            Assignee: Bertrand Delacretaz
> I've been working on a prototype JUnit extension framework [1] that allows JUnit tests
to be injected in a Sling instance, and executed via a test runner servlet.
> Tests are not yet OSGi-aware in the first prototype, but they are dynamically injected
as exported classes in a bundle that points to them with a Test-Package header. Apart from
that they are 100% normal JUnit3 or 4 tests.
> Next step is to use annotations to inject services in the tests, I'm thinking of something
>   @TestReference
>   SlingRepository repository
> And maybe
> @Test
> @OptionalTest(requiredService=repository)
> public void someTest()...
> which would ignore the test if the repository service is not present.
> The prototype consists of two bundles: "extension" which is the test detection and runner
services, and "testbundle" which provides a few example tests. To play with it, install the
two bundles and access the test servlet at /system/sling/junit/
> [1]

This message is automatically generated by JIRA.
For more information on JIRA, see:


View raw message