forked from faif/python-patterns
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfacade.py
More file actions
Latest commit
58 lines (50 loc) · 1.29 KB
/
Copy pathfacade.py
File metadata and controls
58 lines (50 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
'''http://dpip.testingperspective.com/?p=26'''
importtime
SLEEP=0.5
# Complex Parts
classTC1:
defrun(self):
print("###### In Test 1 ######")
time.sleep(SLEEP)
print("Setting up")
time.sleep(SLEEP)
print("Running test")
time.sleep(SLEEP)
print("Tearing down")
time.sleep(SLEEP)
print("Test Finished\n")
classTC2:
defrun(self):
print("###### In Test 2 ######")
time.sleep(SLEEP)
print("Setting up")
time.sleep(SLEEP)
print("Running test")
time.sleep(SLEEP)
print("Tearing down")
time.sleep(SLEEP)
print("Test Finished\n")
classTC3:
defrun(self):
print("###### In Test 3 ######")
time.sleep(SLEEP)
print("Setting up")
time.sleep(SLEEP)
print("Running test")
time.sleep(SLEEP)
print("Tearing down")
time.sleep(SLEEP)
print("Test Finished\n")
# Facade
classTestRunner:
def__init__(self):
self.tc1=TC1()
self.tc2=TC2()
self.tc3=TC3()
self.tests= [iforiin (self.tc1, self.tc2, self.tc3)]
defrunAll(self):
[i.run() foriinself.tests]
# Client
if__name__=='__main__':
testrunner=TestRunner()
testrunner.runAll()