incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r857261 - in /websites/staging/sling/trunk/content: ./ documentation/development/sling-testing-tools.html
Date Thu, 04 Apr 2013 12:27:16 GMT
Author: buildbot
Date: Thu Apr  4 12:27:15 2013
New Revision: 857261

Log:
Staging update by buildbot for sling

Modified:
    websites/staging/sling/trunk/content/   (props changed)
    websites/staging/sling/trunk/content/documentation/development/sling-testing-tools.html

Propchange: websites/staging/sling/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Thu Apr  4 12:27:15 2013
@@ -1 +1 @@
-1464490
+1464499

Modified: websites/staging/sling/trunk/content/documentation/development/sling-testing-tools.html
==============================================================================
--- websites/staging/sling/trunk/content/documentation/development/sling-testing-tools.html
(original)
+++ websites/staging/sling/trunk/content/documentation/development/sling-testing-tools.html
Thu Apr  4 12:27:15 2013
@@ -98,12 +98,14 @@
 <p>See also <a href="/documentation/tutorials-how-tos/testing-sling-based-applications.html">Testing
Sling-based applications</a> which discusses testing in general.</p>
 <h1 id="server-side-junit-tests-contributed-by-bundles">Server-side JUnit tests contributed
by bundles</h1>
 <p>The services provided by the <a href="">org.apache.sling.junit.core</a>
bundle allow bundles to register JUnit tests, which are executed server-side by the JUnitServlet
registered by default at <code>/system/sling/junit</code>. This bundle is not
dependent on Sling, it should work in other OSGi environments.</p>
-<p>{warning:title=JUnit servlet security}
-Note that the JUnitServlet does not require authentication, so it would allow any client
to run tests. The servlet can be disabled by configuration if needed, but in general the <code>/system</code>
path should not be accessible to website visitors anyway.
-{warning}</p>
-<p>{note:title=SlingJUnitServlet}
-For tighter integration with Sling, the alternate <code>SlingJUnitServlet</code>
is registered with the <code>sling/junit/testing</code> resource type and <code>.junit</code>
selector, if the bundle is running in a Sling system. Using this servlet instead of the plain
JUnitServlet also allows Sling authentication to be used for running the tests, and the standard
Sling request processing is used, including servlet filters for example.
-{note}</p>
+<div class="warning">
+Note that the JUnitServlet does not require authentication, so it would allow any client
to run tests. The servlet can be disabled by configuration if needed, but in general the `/system`
path should not be accessible to website visitors anyway.
+</div>
+
+<div class="note">
+For tighter integration with Sling, the alternate `SlingJUnitServlet` is registered with
the `sling/junit/testing` resource type and `.junit` selector, if the bundle is running in
a Sling system. Using this servlet instead of the plain JUnitServlet also allows Sling authentication
to be used for running the tests, and the standard Sling request processing is used, including
servlet filters for example.
+</div>
+
 <p>To try the JUnitServlet interactively, install the <a href="">org.apache.sling.testing.samples.sampletests</a>
bundle.</p>
 <p>This bundle contains a number of test classes, which are registered with the <code>org.apache.sling.junit.core</code>
services by way of the <code>Sling-Test-Regexp=.*Test</code> bundle header, defined
in the bundle's <code>pom.xml</code>. The JUnit core services use this regular
expression to select which classes of the test bundle should be executed as JUnit tests.</p>
 <p>To list the available tests, open http://localhost:8080/system/sling/junit/ . The
servlet shows available tests, and allows you to execute them via a POST request.</p>
@@ -113,23 +115,23 @@ For tighter integration with Sling, the 
 <p>The <code>@TestReference</code> annotation is used to inject OSGi services
in tests that are executed server side.The <code>BundleContext</code> can also
be injected in this way, see the <a href="">OsgiAwareTest</a> for an example.</p>
 <h2 id="curl-examples">Curl examples</h2>
 <p>Here's an example executing a few tests using curl:</p>
-<p><DIV class="code panel" style="border-style: solid;border-width: 1px;"><DIV
class="codeHeader panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;"><B>Running
tests with curl</B></DIV><DIV class="codeContent panelContent">
-    $ curl -X POST http://localhost:8080/system/sling/junit/org.apache.sling.testing.samples.sampletests.JUnit.json
-    [{
-        "INFO_TYPE": "test",
-        "description": "testPasses(org.apache.sling.testing.samples.sampletests.JUnit3Test)"
-      },{
-        "INFO_TYPE": "test",
-        "description": "testPasses(org.apache.sling.testing.samples.sampletests.JUnit4Test)"
-      },{
-        "INFO_TYPE": "test",
-        "description": "testRequiresBefore(org.apache.sling.testing.samples.sampletests.JUnit4Test)"
-      }
-    ]</p>
+<div class="codehilite"><pre><span class="nv">$</span> <span class="nv">curl</span>
<span class="o">-</span><span class="n">X</span> <span class="n">POST</span>
<span class="n">http:</span><span class="sr">//</span><span class="n">localhost:8080</span><span
class="sr">/system/s</span><span class="n">ling</span><span class="sr">/junit/o</span><span
class="n">rg</span><span class="o">.</span><span class="n">apache</span><span
class="o">.</span><span class="n">sling</span><span class="o">.</span><span
class="n">testing</span><span class="o">.</span><span class="n">samples</span><span
class="o">.</span><span class="n">sampletests</span><span class="o">.</span><span
class="n">JUnit</span><span class="o">.</span><span class="n">json</span>
+<span class="p">[{</span>
+    <span class="s">&quot;INFO_TYPE&quot;</span><span class="p">:</span>
<span class="s">&quot;test&quot;</span><span class="p">,</span>
+    <span class="s">&quot;description&quot;</span><span class="p">:</span>
<span class="s">&quot;testPasses(org.apache.sling.testing.samples.sampletests.JUnit3Test)&quot;</span>
+  <span class="p">},{</span>
+    <span class="s">&quot;INFO_TYPE&quot;</span><span class="p">:</span>
<span class="s">&quot;test&quot;</span><span class="p">,</span>
+    <span class="s">&quot;description&quot;</span><span class="p">:</span>
<span class="s">&quot;testPasses(org.apache.sling.testing.samples.sampletests.JUnit4Test)&quot;</span>
+  <span class="p">},{</span>
+    <span class="s">&quot;INFO_TYPE&quot;</span><span class="p">:</span>
<span class="s">&quot;test&quot;</span><span class="p">,</span>
+    <span class="s">&quot;description&quot;</span><span class="p">:</span>
<span class="s">&quot;testRequiresBefore(org.apache.sling.testing.samples.sampletests.JUnit4Test)&quot;</span>
+  <span class="p">}</span>
+<span class="p">]</span>
+</pre></div>
+
+
 <p>And another example with a test that fails:
-<DIV class="code panel" style="border-style: solid;border-width: 1px;"><DIV class="codeHeader
panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;"><B>Failing
tests with curl</B></DIV><DIV class="codeContent panelContent">
-    $ curl -X POST http://localhost:8080/system/sling/junit/org.apache.sling.testing.samples.failingtests.JUnit4FailingTest.json
-    [continuous integration|SLINGxSITE:Project Information]</p>
+    $ curl -X POST http://localhost:8080/system/sling/junit/org.apache.sling.testing.samples.failingtests.JUnit4FailingTest.json</p>
 <h1 id="scriptable-server-side-tests">Scriptable server-side tests</h1>
 <p>If the <a href="">org.apache.sling.junit.scriptable</a> bundle is active
in a Sling system, (in addition to the <code>org.apache.sling.junit.core</code>
bundle), scriptable tests can be executed by the <code>JUnitServlet</code> according
to the following rules:</p>
 <ul>
@@ -162,7 +164,7 @@ For tighter integration with Sling, the 
 <p>The <a href="">SlingRemoteExecutionRule</a> is a JUnit Rule that allows
tests to be executed remotely in a Sling instance from an IDE, assuming the test is available
on both sides.</p>
 <p>The <a href="">ExampleRemoteTest</a> class demonstrates this. To run
it from your IDE, set the <code>sling.remote.test.url</code> in the IDE to the
URL of the JUnitServlet, like http://localhost:8080/system/sling/junit for example.</p>
       <div class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
-        Rev. 1453385 by bdelacretaz on Wed, 6 Mar 2013 15:28:50 +0000
+        Rev. 1464499 by bdelacretaz on Thu, 4 Apr 2013 12:27:09 +0000
       </div>
       <div class="trademarkFooter"> 
         Apache Sling, Sling, Apache, the Apache feather logo, and the Apache Sling project



Mime
View raw message