You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2014/10/20 14:42:07 UTC
svn commit: r1633137 -
/sling/site/trunk/content/documentation/development/sling-testing-tools.mdtext
Author: bdelacretaz
Date: Mon Oct 20 12:42:07 2014
New Revision: 1633137
URL: http://svn.apache.org/r1633137
Log:
Add curl-based scriptable test example
Modified:
sling/site/trunk/content/documentation/development/sling-testing-tools.mdtext
Modified: sling/site/trunk/content/documentation/development/sling-testing-tools.mdtext
URL: http://svn.apache.org/viewvc/sling/site/trunk/content/documentation/development/sling-testing-tools.mdtext?rev=1633137&r1=1633136&r2=1633137&view=diff
==============================================================================
--- sling/site/trunk/content/documentation/development/sling-testing-tools.mdtext (original)
+++ sling/site/trunk/content/documentation/development/sling-testing-tools.mdtext Mon Oct 20 12:42:07 2014
@@ -68,6 +68,32 @@ If the [org.apache.sling.junit.scriptabl
The [ScriptableTestsTest](http://svn.apache.org/repos/asf/sling/trunk/testing/samples/integration-tests/src/test/java/org/apache/sling/testing/samples/integrationtests/serverside/scriptable/ScriptableTestsTest.java) class, from the integration test samples module described below, sets up such a test node and its accompanying script, and calls the JUnitServlet to execute the test. It can be used as a detailed example of how this works.
+Here's a minimal example that sets up and executes a scriptable test:
+
+ $ curl -u admin:admin -Fjcr:primaryNodeType=sling:Folder -Fsling:resourceType=foo -Fjcr:mixinTypes=sling:Test http://localhost:8080/apps/foo
+ ...
+ $ echo TEST_PASSED > /tmp/test.txt.esp ; curl -u admin:admin -T/tmp/test.txt.esp http://localhost:8080/apps/foo/test.txt.esp
+
+At this point, foo.test.txt is what the scriptable test framework will request, and that outputs just TEST_PASSED:
+
+ $ curl -u admin:admin http://localhost:8080/apps/foo.test.txt
+ TEST_PASSED
+
+And a POST to the JUnit servlet returns information on the test's execution:
+
+ curl -u admin:admin -XPOST http://localhost:8080/system/sling/junit/org.apache.sling.junit.scriptable.ScriptableTestsProvider.json
+ [{
+ "INFO_TYPE": "test",
+ "description": "verifyContent[0](org.apache.sling.junit.scriptable.TestAllPaths)",
+ "test_metadata": {
+ "test_execution_time_msec": 2
+ }
+ }
+ ]
+
+Test failures would be included in this JSON representation - you can test that by modifying the script to fail a making the
+same request again.
+
# Integration tests example
The [testing/samples/integration-tests](http://svn.apache.org/repos/asf/sling/trunk/testing/samples/integration-tests) module runs some simple integration tests against a Sling Launchpad instance that's setup from scratch before running the tests.