Author: buildbot
Date: Fri Jun 12 07:15:32 2015
New Revision: 954568
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 Fri Jun 12 07:15:32 2015
@@ -1 +1 @@
-1684885
+1685039
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
Fri Jun 12 07:15:32 2015
@@ -183,15 +183,17 @@ same request again. </p>
<p>This module's pom and Java code can be used as examples to setup your own
integration testing modules for Sling-based apps - or for any other runnable
jar that provides an http service.</p>
<p>Besides serving as examples, some of the tests in this module are used to
validate the testing tools. They run as part of the full Sling <a
href="/project-information.html">continuous integration</a> build, so they're
guaranteed to be correct examples if that build is successful.</p>
<p>The sample uses the <a
href="http://svn.apache.org/repos/asf/sling/trunk/testing/tools">testing/tools</a>
to make the test code simpler. See the
[OsgiConsoleTest|https://svn.apache.org/repos/asf/sling/trunk/testing/samples/integration-tests/src/test/java/org/apache/sling/testing/samples/integrationtests/http/OsgiConsoleTest.java]
class for an example of a test that's very readable and requires no test setup
or boilerplate code.</p>
-<p>The following steps are executed in the <code>integration-test</code> phase
of this module's Maven build:
-1. A random port number for the Sling server is selected by the Maven build
helper plugin, unless explicitely set (see pom.xml for such options).
-1. Additional bundles, defined in the module's pom, are downloaded from the
Maven repository in the <code>target/sling/additional-bundles</code> folder.
-1. The first test that inherits from the <a
href="https://svn.apache.org/repos/asf/sling/trunk/testing/tools/src/main/java/org/apache/sling/testing/tools/sling/SlingTestBase.java">SlingTestBase</a>
class causes the Sling runnable jar (defined as a dependency in the module's
pom) to be started.
-1. # The <code>SlingTestBase</code> class waits for the Sling server to be
ready, based on URLs and expected responses defined in the pom.
-1. # The <code>SlingTestBase</code> class installs and starts the bundles
found in the <code>target/sling/additional-bundles</code> folder.
-1. The test can now either test Sling directly via its http interface, or use
the JUnitServlet to execute server-side tests contributed by bundles or
scripts, as described above.
-1. The Sling runnable jar is stopped when the test VM exits.
-1. The test results are reported via the usual Maven mechanisms.</p>
+<p>The following steps are executed in the <code>integration-test</code> phase
of this module's Maven build:</p>
+<ol>
+<li>A random port number for the Sling server is selected by the Maven build
helper plugin, unless explicitely set (see pom.xml for such options).</li>
+<li>Additional bundles, defined in the module's pom, are downloaded from the
Maven repository in the <code>target/sling/additional-bundles</code>
folder.</li>
+<li>The first test that inherits from the <a
href="https://svn.apache.org/repos/asf/sling/trunk/testing/tools/src/main/java/org/apache/sling/testing/tools/sling/SlingTestBase.java">SlingTestBase</a>
class causes the Sling runnable jar (defined as a dependency in the module's
pom) to be started. </li>
+<li>The <code>SlingTestBase</code> class waits for the Sling server to be
ready, based on URLs and expected responses defined in the pom.</li>
+<li>The <code>SlingTestBase</code> class installs and starts the bundles found
in the <code>target/sling/additional-bundles</code> folder.</li>
+<li>The test can now either test Sling directly via its http interface, or use
the JUnitServlet to execute server-side tests contributed by bundles or
scripts, as described above.</li>
+<li>The Sling runnable jar is stopped when the test VM exits.</li>
+<li>The test results are reported via the usual Maven mechanisms.</li>
+</ol>
<p>If <code>-DkeepJarRunning</code> is used on the Maven command line, the
Sling runnable jar does not exit, to allow for running individual tests against
this instance, for example when debugging the tests or the server code. See the
pom for details.</p>
<h1 id="remote-test-execution">Remote test execution</h1>
<p>The testing tools support two types of remote test execution.</p>
@@ -204,8 +206,16 @@ for an example of how to do that.</p>
<h2 id="slingremoteexecutionrule">SlingRemoteExecutionRule</h2>
<p>The <a
href="http://svn.apache.org/repos/asf/sling/trunk/testing/junit/remote/src/main/java/org/apache/sling/junit/remote/ide/SlingRemoteExecutionRule.java">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="https://svn.apache.org/repos/asf/sling/trunk/testing/junit/remote/src/main/java/org/apache/sling/junit/remote/exported/ExampleRemoteTest.java">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>
+<h1 id="debugging-its">Debugging ITs</h1>
+<p>The JVM is usually forked twice during the execution of integration tests.
The first time by the <code>maven-surefire-plugin</code> which executes the
client-side (i.e. Maven-side) part of the tests. To debug this side the option
<code>-Dmaven.surefire.debug</code> can be used which waits for a debugger to
be attached on port 5005 before the (client-side) test is executed. More
information is available in the <a
href="http://maven.apache.org/surefire/maven-surefire-plugin/examples/debugging.html">documentation
of the maven-surefire-plugin</a>.</p>
+<p>Then the <code>JarExecutor</code> is forking the VM a second time to start
the server (this does not happen if connecting to an already running instance).
The system environment variable <code>jar.executor.vm.options</code> can be
used to start that VM with debug options. All debug options are described at
the <a
href="http://docs.oracle.com/javase/7/docs/technotes/guides/jpda/conninv.html#Invocation">JPDA
documentation</a>. If running </p>
+<div class="codehilite"><pre><span class="n">mvn</span> <span
class="n">test</span> <span class="o">-</span><span class="n">Djar</span><span
class="p">.</span><span class="n">executor</span><span class="p">.</span><span
class="n">vm</span><span class="p">.</span><span class="n">options</span><span
class="p">=</span>"<span class="o">-</span><span
class="n">agentlib</span><span class="p">:</span><span
class="n">jdwp</span><span class="p">=</span><span
class="n">transport</span><span class="p">=</span><span
class="n">dt_socket</span><span class="p">,</span><span
class="n">server</span><span class="p">=</span><span class="n">y</span><span
class="p">,</span><span class="n">suspend</span><span class="p">=</span><span
class="n">y</span><span class="p">,</span><span class="n">address</span><span
class="p">=</span>8000"
+</pre></div>
+
+
+<p>the server start is interrupted until a debugger is connected on port
8000.</p>
<div class="timestamp" style="margin-top: 30px; font-size: 80%;
text-align: right;">
- Rev. 1641357 by bdelacretaz on Mon, 24 Nov 2014 10:34:00 +0000
+ Rev. 1685039 by kwin on Fri, 12 Jun 2015 07:15:19 +0000
</div>
<div class="trademarkFooter">
Apache Sling, Sling, Apache, the Apache feather logo, and the Apache
Sling project