Skip to content

Commit e5fa7db

Browse files
committed
Update the GUI Test Runner
1 parent b02a1e9 commit e5fa7db

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

examples/gui_test_runner.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
(Use Python 3 - There are GUI issues when using Python 2)
55
"""
66

7-
import os
7+
import subprocess
88
import sys
99

1010
if sys.version_info[0] >= 3:
@@ -21,13 +21,13 @@ def __init__(self, master):
2121
self.title = Label(frame, text="", fg="black").pack()
2222
self.title1 = Label(
2323
frame,
24-
text=("Run a Test in Chrome:"),
24+
text=("Run a Test in Chrome (default):"),
2525
fg="blue",
2626
).pack()
2727
self.run1 = Button(
2828
frame,
2929
command=self.run_1,
30-
text=("pytest my_first_test.py --browser=chrome"),
30+
text=("pytest my_first_test.py"),
3131
fg="green",
3232
).pack()
3333
self.title2 = Label(
@@ -38,7 +38,7 @@ def __init__(self, master):
3838
self.run2 = Button(
3939
frame,
4040
command=self.run_2,
41-
text=("pytest my_first_test.py --browser=firefox"),
41+
text=("pytest my_first_test.py --firefox"),
4242
fg="green",
4343
).pack()
4444
self.title3 = Label(
@@ -49,40 +49,40 @@ def __init__(self, master):
4949
self.run3 = Button(
5050
frame,
5151
command=self.run_3,
52-
text=("pytest my_first_test.py --browser=chrome --demo_mode"),
52+
text=("pytest my_first_test.py --demo_mode"),
5353
fg="green",
5454
).pack()
5555
self.title4 = Label(
5656
frame,
57-
text="Run a Parameterized Test:",
57+
text="Run a Parameterized Test and reuse session:",
5858
fg="blue",
5959
).pack()
6060
self.run4 = Button(
6161
frame,
6262
command=self.run_4,
63-
text=("pytest parameterized_test.py --browser=chrome"),
63+
text=("pytest parameterized_test.py --rs"),
6464
fg="green",
6565
).pack()
6666
self.title5 = Label(
6767
frame,
68-
text="Run a Failing Test (automatic screenshots):",
68+
text="Run a Failing Test with a Test Report:",
6969
fg="blue",
7070
).pack()
7171
self.run5 = Button(
7272
frame,
7373
command=self.run_5,
74-
text=("pytest test_fail.py --browser=chrome"),
74+
text=("pytest test_fail.py --html=report.html"),
7575
fg="red",
7676
).pack()
7777
self.title6 = Label(
7878
frame,
79-
text="Run a Failing Test Suite with a Test Report:",
79+
text="Run a Failing Test Suite with the Dashboard:",
8080
fg="blue",
8181
).pack()
8282
self.run6 = Button(
8383
frame,
8484
command=self.run_6,
85-
text=("pytest test_suite.py --browser=chrome --html=report.html"),
85+
text=("pytest test_suite.py --rs --dashboard"),
8686
fg="red",
8787
).pack()
8888
self.title7 = Label(
@@ -93,37 +93,37 @@ def __init__(self, master):
9393
self.run7 = Button(
9494
frame,
9595
command=self.run_7,
96-
text=("pytest test_deferred_asserts.py --browser=chrome"),
96+
text=("pytest test_deferred_asserts.py"),
9797
fg="red",
9898
).pack()
9999
self.end_title = Label(frame, text="", fg="black").pack()
100100
self.quit = Button(frame, text="QUIT", command=frame.quit).pack()
101101

102102
def run_1(self):
103-
os.system("pytest my_first_test.py --browser=chrome")
103+
subprocess.Popen("pytest my_first_test.py", shell=True)
104104

105105
def run_2(self):
106-
os.system("pytest my_first_test.py --browser=firefox")
106+
subprocess.Popen("pytest my_first_test.py --firefox", shell=True)
107107

108108
def run_3(self):
109-
os.system("pytest my_first_test.py --browser=chrome --demo_mode")
109+
subprocess.Popen("pytest my_first_test.py --demo_mode", shell=True)
110110

111111
def run_4(self):
112-
os.system("pytest parameterized_test.py --browser=chrome")
112+
subprocess.Popen("pytest parameterized_test.py --rs", shell=True)
113113

114114
def run_5(self):
115-
os.system("pytest test_fail.py --browser=chrome")
115+
subprocess.Popen("pytest test_fail.py --html=report.html", shell=True)
116116

117117
def run_6(self):
118-
os.system("pytest test_suite.py --browser=chrome --html=report.html")
118+
subprocess.Popen("pytest test_suite.py --rs --dashboard", shell=True)
119119

120120
def run_7(self):
121-
os.system("pytest test_deferred_asserts.py --browser=chrome")
121+
subprocess.Popen("pytest test_deferred_asserts.py", shell=True)
122122

123123

124124
if __name__ == "__main__":
125125
root = Tk()
126126
root.title("Select Test Job To Run")
127-
root.minsize(500, 420)
127+
root.minsize(320, 420)
128128
app = App(root)
129129
root.mainloop()

0 commit comments

Comments
 (0)