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/09/04 13:03:07 UTC

[sling-whiteboard] branch master updated (1f51e15 -> 1451d2c)

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

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


    from 1f51e15  Move Karate tests here
     new 95e1ad1  Use classpath: to read files
     new 1451d2c  Add Gatling performance tests

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 karate-http-testing/pom.xml                        | 18 ++++++++++++++
 .../createcontent/createContent.feature            |  2 +-
 .../createcontent/importContent.feature            |  2 +-
 .../test/scala/sling/PostServletSimulation.scala   | 29 ++++++++++++++++++++++
 4 files changed, 49 insertions(+), 2 deletions(-)
 create mode 100644 karate-http-testing/src/test/scala/sling/PostServletSimulation.scala


[sling-whiteboard] 01/02: Use classpath: to read files

Posted by bd...@apache.org.
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 95e1ad157b7b15e85fe44ff34a1751b5f758ab71
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Tue Sep 4 14:27:57 2018 +0200

    Use classpath: to read files
---
 .../src/test/java/sling/postservlet/createcontent/createContent.feature | 2 +-
 .../src/test/java/sling/postservlet/createcontent/importContent.feature | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/karate-http-testing/src/test/java/sling/postservlet/createcontent/createContent.feature b/karate-http-testing/src/test/java/sling/postservlet/createcontent/createContent.feature
index 5ba7867..cc5a588 100644
--- a/karate-http-testing/src/test/java/sling/postservlet/createcontent/createContent.feature
+++ b/karate-http-testing/src/test/java/sling/postservlet/createcontent/createContent.feature
@@ -9,7 +9,7 @@ Background:
 * url baseURL
 
 # Use admin credentials for all requests
-* configure headers = call read('../../util/basic-auth-header.js') { username: 'admin', password: 'admin' }
+* configure headers = call read('classpath:sling/util/basic-auth-header.js') { username: 'admin', password: 'admin' }
 
 * def testID = '' + java.util.UUID.randomUUID()
 * def testFolderPath = '/createContentTest' + testID
diff --git a/karate-http-testing/src/test/java/sling/postservlet/createcontent/importContent.feature b/karate-http-testing/src/test/java/sling/postservlet/createcontent/importContent.feature
index b773b4a..90e8528 100644
--- a/karate-http-testing/src/test/java/sling/postservlet/createcontent/importContent.feature
+++ b/karate-http-testing/src/test/java/sling/postservlet/createcontent/importContent.feature
@@ -6,7 +6,7 @@ Background:
 * url baseURL
 
 # Use admin credentials for all requests
-* configure headers = call read('../..//util/basic-auth-header.js') { username: 'admin', password: 'admin' }
+* configure headers = call read('classpath:sling/util/basic-auth-header.js') { username: 'admin', password: 'admin' }
 
 * def testID = '' + java.util.UUID.randomUUID()
 * def testFolderPath = 'importContentTest/' + testID


[sling-whiteboard] 02/02: Add Gatling performance tests

Posted by bd...@apache.org.
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 1451d2c02f5f528dfb21468b72e98aab4962813c
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Tue Sep 4 15:02:47 2018 +0200

    Add Gatling performance tests
---
 karate-http-testing/pom.xml                        | 18 ++++++++++++++
 .../test/scala/sling/PostServletSimulation.scala   | 29 ++++++++++++++++++++++
 2 files changed, 47 insertions(+)

diff --git a/karate-http-testing/pom.xml b/karate-http-testing/pom.xml
index 8c17fba..6569dd8 100644
--- a/karate-http-testing/pom.xml
+++ b/karate-http-testing/pom.xml
@@ -12,6 +12,7 @@
         <java.version>1.8</java.version>
         <maven.compiler.version>3.6.0</maven.compiler.version>
         <karate.version>0.8.0</karate.version>
+        <gatling.plugin.version>2.2.4</gatling.plugin.version>
     </properties>    
 
     <dependencies>
@@ -27,6 +28,12 @@
             <version>${karate.version}</version>
             <scope>test</scope>
         </dependency>		
+        <dependency>
+            <groupId>com.intuit.karate</groupId>
+            <artifactId>karate-gatling</artifactId>
+            <version>${karate.version}</version>
+            <scope>test</scope>
+        </dependency> 
     </dependencies>
 
     <build>
@@ -50,6 +57,17 @@
                     <compilerArgument>-Werror</compilerArgument>
                 </configuration>
             </plugin>
+            <plugin>
+                <groupId>io.gatling</groupId>
+                <artifactId>gatling-maven-plugin</artifactId>
+                <version>${gatling.plugin.version}</version>
+                <configuration>
+                    <simulationsFolder>src/test/scala</simulationsFolder>
+                    <includes>
+                        <include>sling.PostServletSimulation</include>
+                    </includes>
+                </configuration>
+            </plugin>         
         </plugins>        
     </build>       
     
diff --git a/karate-http-testing/src/test/scala/sling/PostServletSimulation.scala b/karate-http-testing/src/test/scala/sling/PostServletSimulation.scala
new file mode 100644
index 0000000..adcc5fa
--- /dev/null
+++ b/karate-http-testing/src/test/scala/sling/PostServletSimulation.scala
@@ -0,0 +1,29 @@
+package sling
+
+import com.intuit.karate.gatling.PreDef.{pauseFor, _}
+import io.gatling.core.Predef._
+
+import scala.concurrent.duration._
+
+/* Example Gatling performance tests which reuse Karate scenarios.
+ *
+ * Run with 
+ *  mvn clean test-compile gatling:test
+ *
+ * And see the output for the Gatling report filename.
+ */
+class PostServletSimulation extends Simulation {
+
+  val protocol = karateProtocol(
+    "/createContentTest/*" -> pauseFor("post" -> 2, "get" -> 5, "delete" -> 2),
+    "/importContentTest/*" -> pauseFor("post" -> 7, "get" -> 15, "delete" -> 50),
+  )
+
+  val createContent = scenario("create").exec(karateFeature("classpath:sling/postservlet/createcontent/createContent.feature"))
+  val importContent = scenario("import").exec(karateFeature("classpath:sling/postservlet/createcontent/importContent.feature"))
+
+  setUp(
+    createContent.inject(rampUsers(75) over (5 seconds)).protocols(protocol),
+    importContent.inject(rampUsers(125) over (3 seconds)).protocols(protocol)
+  )
+}
\ No newline at end of file