Changeset 52553 for funkload/trunk
- Timestamp:
- 02/11/08 22:43:38 (7 months ago)
- Files:
-
- funkload/trunk/CHANGES.txt (modified) (1 diff)
- funkload/trunk/README.txt (modified) (4 diffs)
- funkload/trunk/funkload/FunkLoadTestCase.py (modified) (2 diffs)
- funkload/trunk/funkload/Recorder.py (modified) (4 diffs)
- funkload/trunk/funkload/data/MyFacesScriptTestCase.tpl (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
funkload/trunk/CHANGES.txt
r52195 r52553 22 22 :Snapshots: http://funkload.nuxeo.org/snapshots/ 23 23 24 :Target: 1.6.3 24 :Target: 1.7.0 25 26 New features 27 ~~~~~~~~~~~~ 28 29 * Recorder and test take care of JSF MyFaces tokens which make FunkLoad 30 ready to record/play Nuxeo EP or any JBoss Seam application. 31 32 * Change API of listHref to be able to search on link content as well as 33 link url. `pattern` parameter is renamed into `url_pattern` and a new 34 `content_pattern` can be supply. 35 25 36 26 37 Bug fixes funkload/trunk/README.txt
r51931 r52553 7 7 :address: bdelbosc _at_ nuxeo.com 8 8 9 :version: FunkLoad/1. 6.29 :version: FunkLoad/1.7.0 10 10 11 11 :revision: $Id$ … … 112 112 113 113 * Easy to install (EasyInstall_) and use, see examples in the demo_ folder. 114 115 * Works fine with CPS or any Zope application, CherryPy, Nuxeo EP or any 116 JBoss Seam application ... 114 117 115 118 … … 578 581 but will failed to record https session. 579 582 583 Note that ``fl-record`` will handle automaticly JSF Myfaces token, which 584 enable to easily record and play any JBoss Seam application. 585 580 586 581 587 The fl-record command … … 867 873 :: 868 874 869 listHref( pattern=None)875 listHref(url_pattern=None, content_pattern=None): 870 876 871 877 Return a list of href anchor url present in the last html response, 872 filtering href using the ``pattern`` regex if present. 878 filtering href using the ``url_pattern`` regex if present and filtering the 879 text content of the link with content_pattern if present. 873 880 874 881 funkload/trunk/funkload/FunkLoadTestCase.py
r52283 r52553 504 504 return '' 505 505 506 def listHref(self, pattern=None):506 def listHref(self, url_pattern=None, content_pattern=None): 507 507 """Return a list of href anchor url present in the last html response. 508 508 509 Filtering href using the pattern regex if present."""509 Filtering href with url pattern or link text pattern.""" 510 510 response = self._response 511 511 ret = [] … … 513 513 a_links = response.getDOM().getByName('a') 514 514 if a_links: 515 ret = [getattr(x, 'href', '') for x in a_links] 516 if pattern is not None: 517 pat = re.compile(pattern) 518 ret = [href for href in ret if pat.search(href) is not None] 519 return ret 515 for link in a_links: 516 try: 517 ret.append((link.getContentString(), link.href)) 518 except AttributeError: 519 pass 520 if url_pattern is not None: 521 pat = re.compile(url_pattern) 522 ret = [link for link in ret 523 if pat.search(link[1]) is not None] 524 if content_pattern is not None: 525 pat = re.compile(content_pattern) 526 ret = [link for link in ret 527 if link[0] and (pat.search(link[0]) is not None)] 528 return [link[1] for link in ret] 520 529 521 530 def getLastBaseUrl(self): funkload/trunk/funkload/Recorder.py
r52195 r52553 140 140 class RecorderProgram: 141 141 """A tcpwatch to funkload recorder.""" 142 MYFACES_STATE = 'org.apache.myfaces.trinidad.faces.STATE' 143 MYFACES_FORM = 'org.apache.myfaces.trinidad.faces.FORM' 142 144 USAGE = """%prog [options] [test_name] 143 145 … … 174 176 self.script_path = None 175 177 self.configuration_path = None 178 self.use_myfaces = False 176 179 self.parseArgs(argv) 177 180 … … 280 283 else: 281 284 text.append('self.%s(server_url + "%s"' % ( 282 request.method.lower(), request.rurl ))285 request.method.lower(), request.rurl.strip())) 283 286 description = "%s %s" % (request.method.capitalize(), 284 287 request.path | truncate(42)) 285 288 if request.body: 286 params = ('params=%s' % request.extractParam()) 289 params = request.extractParam() 290 myfaces_form = None 291 if self.MYFACES_STATE not in [key for key, value in params]: 292 params = 'params=%s' % params 293 else: 294 # apache myfaces state add a wrapper 295 self.use_myfaces = True 296 new_params = [] 297 for key, value in params: 298 if key == self.MYFACES_STATE: 299 continue 300 if key == self.MYFACES_FORM: 301 myfaces_form = value 302 continue 303 new_params.append([key, value]) 304 params = " self.myfacesParams(%s, form='%s')" % (new_params, 305 myfaces_form) 287 306 params = re.sub("'Upload\(([^\)]*)\)'", "Upload(\\1)", params) 288 307 text.append(', ' + params) … … 306 325 trace('Creating script: %s.\n' % self.script_path) 307 326 from pkg_resources import resource_string 308 tpl = resource_string('funkload', 'data/ScriptTestCase.tpl') 327 if self.use_myfaces: 328 tpl_name = 'data/MyFacesScriptTestCase.tpl' 329 else: 330 tpl_name = 'data/ScriptTestCase.tpl' 331 tpl = resource_string('funkload', tpl_name) 309 332 content = tpl % {'script': script, 310 333 'test_name': self.test_name,
