-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy pathgui_test_runner.py
121 lines (110 loc) · 3.47 KB
/
gui_test_runner.py
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
"""GUI TEST RUNNER
Run by Typing: "python gui_test_runner.py"
(Use Python 3)"""
import subprocess
from tkinter import Tk, Frame, Button, Label
class App:
def __init__(self, master):
frame = Frame(master)
frame.pack()
self.label = Label(root, width=40).pack()
self.title = Label(frame, text="", fg="black").pack()
self.title1 = Label(
frame,
text=("Run a Test in Chrome (default):"),
fg="blue",
).pack()
self.run1 = Button(
frame,
command=self.run_1,
text=("pytest my_first_test.py"),
fg="green",
).pack()
self.title2 = Label(
frame,
text=("Run a Test in Firefox:"),
fg="blue",
).pack()
self.run2 = Button(
frame,
command=self.run_2,
text=("pytest my_first_test.py --firefox"),
fg="green",
).pack()
self.title3 = Label(
frame,
text="Run a Test with Demo Mode:",
fg="blue",
).pack()
self.run3 = Button(
frame,
command=self.run_3,
text=("pytest my_first_test.py --demo_mode"),
fg="green",
).pack()
self.title4 = Label(
frame,
text="Run a Parameterized Test and reuse session:",
fg="blue",
).pack()
self.run4 = Button(
frame,
command=self.run_4,
text=("pytest parameterized_test.py --rs"),
fg="green",
).pack()
self.title5 = Label(
frame,
text="Run a Failing Test with a Test Report:",
fg="blue",
).pack()
self.run5 = Button(
frame,
command=self.run_5,
text=("pytest test_fail.py --html=report.html"),
fg="red",
).pack()
self.title6 = Label(
frame,
text="Run a Failing Test Suite with the Dashboard:",
fg="blue",
).pack()
self.run6 = Button(
frame,
command=self.run_6,
text=("pytest test_suite.py --rs --dashboard"),
fg="red",
).pack()
self.title7 = Label(
frame,
text="Run a Failing Test with Deferred Asserts:",
fg="blue",
).pack()
self.run7 = Button(
frame,
command=self.run_7,
text=("pytest test_deferred_asserts.py"),
fg="red",
).pack()
self.end_title = Label(frame, text="", fg="black").pack()
self.quit = Button(frame, text="QUIT", command=frame.quit).pack()
def run_1(self):
subprocess.Popen("pytest my_first_test.py", shell=True)
def run_2(self):
subprocess.Popen("pytest my_first_test.py --firefox", shell=True)
def run_3(self):
subprocess.Popen("pytest my_first_test.py --demo_mode", shell=True)
def run_4(self):
subprocess.Popen("pytest parameterized_test.py --rs", shell=True)
def run_5(self):
subprocess.Popen("pytest test_fail.py --html=report.html", shell=True)
def run_6(self):
subprocess.Popen("pytest test_suite.py --rs --dashboard", shell=True)
def run_7(self):
subprocess.Popen("pytest test_deferred_asserts.py", shell=True)
if __name__ == "__main__":
root = Tk()
root.title("Select Test Job To Run")
root.minsize(320, 420)
app = App(root)
root.mainloop()