You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Bertrand Delacretaz (JIRA)" <ji...@apache.org> on 2011/03/03 16:21:36 UTC

[jira] Resolved: (SLING-2015) Provide a Sling servlet to run server-side JUnit tests

     [ https://issues.apache.org/jira/browse/SLING-2015?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bertrand Delacretaz resolved SLING-2015.
----------------------------------------

    Resolution: Fixed
      Assignee: Bertrand Delacretaz

Implemented in revision 1076648 - the existing servlet at /system/sling/junit stays (although with slightly different URL patterns to select tests), and a new Sling servlet is available that handles the .junit selector.

To activate the Sling JUnit servlet, create a resource with the sling/junit/testing resource type:

  curl -F"sling:resourceType=sling/junit/testing" http://admin:admin@localhost:8080/test/foo

And the tests can then be run as in these examples:

Run all tests in the OsgiAware class:
  curl -X POST http://admin:admin@localhost:8080/test/foo.junit/org.apache.sling.testing.samples.sampletests.OsgiAwareTest.json

Run a single test method from that class:
  curl -X POST http://admin:admin@localhost:8080/test/foo.junit/org.apache.sling.testing.samples.sampletests.OsgiAwareTest/testConfigAdmin.json

Run all tests in a given package:
  curl -X POST http://admin:admin@localhost:8080/test/foo.junit/org.apache.sling.testing.samples.json

Run all available tests:
  curl -X POST http://admin:admin@localhost:8080/test/foo.junit/.json

> Provide a Sling servlet to run server-side JUnit tests
> ------------------------------------------------------
>
>                 Key: SLING-2015
>                 URL: https://issues.apache.org/jira/browse/SLING-2015
>             Project: Sling
>          Issue Type: Improvement
>          Components: Testing
>            Reporter: Bertrand Delacretaz
>            Assignee: Bertrand Delacretaz
>              Labels: integration-tests, junit
>
> The testing/junit/core module currently uses a plain servlet that runs outside of the Sling request cycle.
> However, some tests depend on custom Sling Filters, for example, and as such need to run in the Sling request cycle.
> To keep the junit/core module reusable outside of Sling, I'll  implement a second servlet, that will be active only in a Sling environment. The existing plain servlet can be disabled by configuration if needed.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira