[jboss-svn-commits] JBL Code SVN: r12183 - labs/jbossforums/branches/tests/main/src.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon May 28 13:28:14 EDT 2007


Author: adamw
Date: 2007-05-28 13:28:14 -0400 (Mon, 28 May 2007)
New Revision: 12183

Modified:
   labs/jbossforums/branches/tests/main/src/main.py
   labs/jbossforums/branches/tests/main/src/view_main.py
   labs/jbossforums/branches/tests/main/src/view_post.py
Log:
Viewing a random post in a random forum

Modified: labs/jbossforums/branches/tests/main/src/main.py
===================================================================
--- labs/jbossforums/branches/tests/main/src/main.py	2007-05-28 17:22:37 UTC (rev 12182)
+++ labs/jbossforums/branches/tests/main/src/main.py	2007-05-28 17:28:14 UTC (rev 12183)
@@ -17,6 +17,5 @@
 
 class TestRunner:
     def __call__(self):
-        viewMain()
-        forum_id = random.choice(viewMain.forums_ids)
-        viewPost(forum_id)
\ No newline at end of file
+        forum_id = viewMain()
+        topic_id = viewPost(forum_id)
\ No newline at end of file

Modified: labs/jbossforums/branches/tests/main/src/view_main.py
===================================================================
--- labs/jbossforums/branches/tests/main/src/view_main.py	2007-05-28 17:22:37 UTC (rev 12182)
+++ labs/jbossforums/branches/tests/main/src/view_main.py	2007-05-28 17:28:14 UTC (rev 12183)
@@ -7,6 +7,7 @@
 from HTTPClient import NVPair
 
 import re
+import random
 
 from globals import *
 
@@ -234,17 +235,17 @@
 
     main_request137.GET('/portal-core/themes/renaissance/images/portlet-bottom-right.gif')
 
-    # From the result, reading available forum numbers.
-    self.forums_ids = forum_id_regexp.findall(result.text)  
-
     return result
 
   def all(self):
-    self.page1()      # GET forums (main_requests 101-137)
+    result = self.page1()      # GET forums (main_requests 101-137)
+    
+    # From the result, randomly getting a forum id
+    return random.choice(forum_id_regexp.findall(result.text))
 
   def __call__(self):
     """This method is called for every run performed by the worker thread."""
-    self.all()
+    return self.all()
 
 def instrumentMethod(test, method_name, c=ViewMain):
   """Instrument a method with the given Test."""

Modified: labs/jbossforums/branches/tests/main/src/view_post.py
===================================================================
--- labs/jbossforums/branches/tests/main/src/view_post.py	2007-05-28 17:22:37 UTC (rev 12182)
+++ labs/jbossforums/branches/tests/main/src/view_post.py	2007-05-28 17:28:14 UTC (rev 12183)
@@ -186,7 +186,6 @@
     
     # Browsing the pages a random number of times (from 0 to 4) and until next pages exist
     next_page_clicks = random.randint(0, next_clicks_range)
-    print next_page_clicks
     for i in range(1, next_page_clicks):
         if page_id_regexp.search(result.text) == None:
             break
@@ -199,10 +198,12 @@
     # Getting a random topic
     topic_id = random.choice(self.topic_ids)
     self.page4(forum_id, topic_id)
+    
+    return topic_id
 
   def __call__(self, forum_id):
     """This method is called for every run performed by the worker thread."""
-    self.all(forum_id)
+    return self.all(forum_id)
 
 def instrumentMethod(test, method_name, c=ViewPost):
   """Instrument a method with the given Test."""




More information about the jboss-svn-commits mailing list