Sylvain Hellegouarch avatar Sylvain Hellegouarch committed 09e7db6

added funkload recipe

Comments (0)

Files changed (3)

testing/load/funkload_/Blog.conf

+# main section for the test case
+[main]
+title=Blog load test
+description=Creating comments on blog posts
+url=http://localhost:8090
+
+# a section for each test
+[test_access]
+description=Access the home page once
+
+[test_comment]
+description=Post comments to blog posts
+min_nb_comments=0
+max_nb_comments=7
+
+# a section to configure the test mode
+[ftest]
+log_to = console file
+log_path = simple-test.log
+result_path = simple-test.xml
+sleep_time_min = 0
+sleep_time_max = 0
+
+# a section to configure the bench mode
+[bench]
+cycles = 25:50:75:100
+duration = 60
+startup_delay = 0.1
+sleep_time = 1
+cycle_time = 5
+log_to =
+log_path = load.log
+result_path = load.xml
+sleep_time_min = 0
+sleep_time_max = 3

testing/load/funkload_/README

+Basic recipe for load testing a CherryPy application using funkload.
+
+You will require:
+http://funkload.nuxeo.org
+gnuplot for the report charts
+
+First start the basic myapp found in the parent directory:
+
+ $ cd ../myapp
+ $ python __init__.py
+
+Then in a different shell run the bench:
+
+ $ cd funkload_
+ $ fl-run-bench test_blog.py Blog.test_comment
+
+Generate the load test reports:
+
+ $ fl-build-report --html load.xml
+
+Since the demo app is using sqlite3 and no caching with a fairly intensive load, 
+the results may not be great which is a good example for investigating load problems.

testing/load/funkload_/test_blog.py

+# -*- coding: utf-8 -*-
+import random
+import time
+
+from funkload.Lipsum import Lipsum
+from funkload.FunkLoadTestCase import FunkLoadTestCase
+
+class Blog(FunkLoadTestCase):
+    def test_access(self):
+        server_url = self.conf_get('main', 'url')
+        self.get(server_url + '/', description='Blog home page access')
+
+    def test_comment(self):
+        server_url = self.conf_get('main', 'url')
+        self.get(server_url, description='Blog home page access')
+
+        post_id = random.randint(1, 12)
+        ret = self.post(server_url + "/post/comment/%d" % post_id,
+                        params=[['author', 'virtual author'],
+                                ['text', Lipsum().getParagraph()]],
+                        description="Commenting")
+        self.assert_(ret.code == 200, "Failed to comment")
+
+        self.get(server_url, description='Blog home page access after commenting')
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.