Line | |
---|
1 | import mechanize |
---|
2 | import time |
---|
3 | #from mechanize import Browser |
---|
4 | from zope.testbrowser.browser import Browser |
---|
5 | from helpers import BASE_URL |
---|
6 | |
---|
7 | class Transaction(object): |
---|
8 | def __init__(self): |
---|
9 | self.custom_timers = {} |
---|
10 | self.base_url = BASE_URL + 'applicants' |
---|
11 | |
---|
12 | def run(self): |
---|
13 | browser = Browser() |
---|
14 | #browser.set_handle_robots(False) |
---|
15 | |
---|
16 | |
---|
17 | start_timer = time.time() |
---|
18 | resp = browser.open(self.base_url)#'http://localhost:8080/app-stress/applicants') |
---|
19 | #resp.read() |
---|
20 | latency = time.time() - start_timer |
---|
21 | |
---|
22 | self.custom_timers['SIRP Applicant Section'] = latency |
---|
23 | |
---|
24 | #assert (resp.code == 200), 'Bad HTTP Response' |
---|
25 | assert ('Application Section' in browser.contents),'Failed Content Verification' |
---|
26 | time.sleep(2.0) |
---|
27 | #assert ( |
---|
28 | # 'Application Section' in resp.get_data() |
---|
29 | # ),'Failed Content Verification' |
---|
30 | |
---|
31 | |
---|
32 | if __name__ == '__main__': |
---|
33 | trans = Transaction() |
---|
34 | trans.run() |
---|
35 | print trans.custom_timers |
---|
Note: See
TracBrowser for help on using the repository browser.