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 2018/07/26 14:56:58 UTC

[sling-whiteboard] 05/06: More comments

This is an automated email from the ASF dual-hosted git repository.

bdelacretaz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git

commit 1c6bafe43e32d83e02271750515fcb16fbd22419
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Jul 26 16:55:07 2018 +0200

    More comments
---
 .../createcontent/createContent.feature            | 34 +++++++++++++---------
 1 file changed, 20 insertions(+), 14 deletions(-)

diff --git a/literate-http-testing/karate/src/test/java/sling/postservlet/createcontent/createContent.feature b/literate-http-testing/karate/src/test/java/sling/postservlet/createcontent/createContent.feature
index e7bbc80..5cd7201 100644
--- a/literate-http-testing/karate/src/test/java/sling/postservlet/createcontent/createContent.feature
+++ b/literate-http-testing/karate/src/test/java/sling/postservlet/createcontent/createContent.feature
@@ -1,5 +1,9 @@
 Feature: create content using the Sling POST Servlet
 
+# ------------------------------------------------------------------------
+# TESTS SETUP
+# ------------------------------------------------------------------------
+
 Background:
 
 # TODO for now you need to start Sling manually
@@ -10,29 +14,31 @@ Background:
 # Use admin:admin credentials for all requests
 * configure headers = { 'Authorization' : 'Basic YWRtaW46YWRtaW4=' }
 
-Scenario: get the root resource
-
+# ------------------------------------------------------------------------
+Scenario: Check access to the Sling instance under test
+# ------------------------------------------------------------------------
 Given path '/.json'
 When method get
 Then status 200
 
-Scenario: create a content resource and verify its output
+# ------------------------------------------------------------------------
+Scenario: Create a resource with a POST and read back with a GET
+# ------------------------------------------------------------------------
+* def testID = '' + java.util.UUID.randomUUID()
+* def testTitle = 'Title for the First Resource at ' + testID
 
-* def id = java.util.UUID.randomUUID()
-* def title = 'Title for the First Resource at ' + id
-
-Given url 'http://localhost:8080/tmp/' + id
-And form field title = title
-And form field const = 'const42'
+Given url 'http://localhost:8080/tmp/' + testID
+And form field title = testTitle
+And form field anotherField = testID
 When method POST
 Then status 201
 
+# The Location header indicates where the resource was created
 # TODO use a variable for the base URL
+* def newResourceURL = 'http://localhost:8080' + responseHeaders['Location'][0]
 
-* def location = 'http://localhost:8080' + responseHeaders['Location'][0]
-
-Given url location + '.json'
+Given url newResourceURL + '.json'
 When method get
 Then status 200
-Then match response.title == title
-Then match response.const == 'const42'
\ No newline at end of file
+Then match response.title == testTitle
+Then match response.anotherField == testID
\ No newline at end of file