source: main/waeup.sirp/branches/ulif-stress-multimech/multi-mechanize/projects/sirp1/test_scripts/get_homepage.py @ 7480

Last change on this file since 7480 was 7480, checked in by uli, 13 years ago

Add sirp-related stress-test project.

File size: 873 bytes
Line 
1#!/usr/bin/env python
2#
3#  Copyright (c) 2010 Corey Goldberg (corey@goldb.org)
4#  License: GNU LGPLv3
5#
6#  This file is part of Multi-Mechanize
7import mechanize
8import time
9from mechanize import Browser
10
11class Transaction(object):
12    def __init__(self):
13        self.custom_timers = {}
14
15    def run(self):
16        browser = Browser()
17        browser.set_handle_robots(False)
18
19        start_timer = time.time()
20        resp = browser.open('http://localhost:8080/app-stress')
21        resp.read()
22        latency = time.time() - start_timer
23
24        self.custom_timers['SIRP Homepage Anonymous'] = latency
25
26        assert (resp.code == 200), 'Bad HTTP Response'
27        assert (
28            'Sample University' in resp.get_data()
29            ),'Failed Content Verification'
30
31
32if __name__ == '__main__':
33    trans = Transaction()
34    trans.run()
35    print trans.custom_timers
Note: See TracBrowser for help on using the repository browser.