Skip to content

Commit 9ac6870

Browse files
committed
Update the GUI test runner
1 parent c182e4f commit 9ac6870

File tree

1 file changed

+35
-35
lines changed

1 file changed

+35
-35
lines changed

examples/gui_test_runner.py

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,74 @@
11
'''
22
GUI TEST RUNNER
33
Run by Typing: "python gui_test_runner.py"
4+
(Use Python 3 - There are GUI issues when using Python 2)
45
'''
56

6-
try:
7-
# Python 2
8-
from Tkinter import Tk, Frame, Button, Label
9-
except Exception:
10-
# Python 3
11-
from tkinter import Tk, Frame, Button, Label
127
import os
8+
import sys
9+
if sys.version_info[0] >= 3:
10+
from tkinter import Tk, Frame, Button, Label
11+
else:
12+
from Tkinter import Tk, Frame, Button, Label
1313

1414

1515
class App:
1616

1717
def __init__(self, master):
18-
frame = Frame()
18+
frame = Frame(master)
1919
frame.pack()
20-
root.title("Select Test Job To Run")
2120
self.label = Label(root, width=40).pack()
2221
self.title = Label(frame, text="", fg="black").pack()
2322
self.title1 = Label(
24-
frame, text="Basic Test Run in Chrome:", fg="blue").pack()
23+
frame, text=("Run a Test in Chrome:"), fg="blue").pack()
2524
self.run1 = Button(
2625
frame, command=self.run_1,
27-
text=("pytest my_first_test.py"
28-
" --browser=chrome")).pack()
26+
text=("pytest my_first_test.py --browser=chrome"),
27+
fg="green").pack()
2928
self.title2 = Label(
30-
frame, text="Basic Test Run in Firefox:", fg="blue").pack()
29+
frame, text=("Run a Test in Firefox:"), fg="blue").pack()
3130
self.run2 = Button(
3231
frame, command=self.run_2,
33-
text=("pytest my_first_test.py"
34-
" --browser=firefox")).pack()
32+
text=("pytest my_first_test.py --browser=firefox"),
33+
fg="green").pack()
3534
self.title3 = Label(
36-
frame, text="Basic Test Run in Demo Mode:", fg="blue").pack()
35+
frame, text="Run a Test with Demo Mode:", fg="blue").pack()
3736
self.run3 = Button(
3837
frame, command=self.run_3,
39-
text=("pytest my_first_test.py"
40-
" --browser=chrome --demo_mode")).pack()
38+
text=("pytest my_first_test.py --browser=chrome --demo_mode"),
39+
fg="green").pack()
4140
self.title4 = Label(
4241
frame,
43-
text="Basic Failing Test Run with Screenshots:",
42+
text="Run a Parameterized Test:",
4443
fg="blue").pack()
4544
self.run4 = Button(
4645
frame, command=self.run_4,
47-
text=("nosetests test_fail.py"
48-
" --browser=chrome --demo_mode")).pack()
46+
text=("pytest parameterized_test.py --browser=chrome"),
47+
fg="green").pack()
4948
self.title5 = Label(
5049
frame,
51-
text="Basic Failing Test Suite Run with Test Report:",
50+
text="Run a Failing Test (automatic screenshots):",
5251
fg="blue").pack()
5352
self.run5 = Button(
5453
frame, command=self.run_5,
55-
text=("nosetests test_suite.py --report --show_report")).pack()
54+
text=("pytest test_fail.py --browser=chrome"),
55+
fg="red").pack()
5656
self.title6 = Label(
5757
frame,
58-
text="Basic Failing Test Run showing the Multiple-Checks feature:",
58+
text="Run a Failing Test Suite with a Test Report:",
5959
fg="blue").pack()
6060
self.run6 = Button(
6161
frame, command=self.run_6,
62-
text=("nosetests delayed_assert_test.py --browser=chrome")).pack()
62+
text=("pytest test_suite.py --browser=chrome --html=report.html"),
63+
fg="red").pack()
6364
self.title7 = Label(
6465
frame,
65-
text="Use MySQL DB Reporting: (See ReadMe.md for Setup Steps!)",
66+
text="Run a Failing Test with Delayed Asserts:",
6667
fg="blue").pack()
6768
self.run7 = Button(
6869
frame, command=self.run_7,
69-
text=("nosetests test_suite.py"
70-
" --browser=chrome --with-db_reporting")).pack()
70+
text=("pytest test_delayed_asserts.py --browser=chrome"),
71+
fg="red").pack()
7172
self.end_title = Label(frame, text="", fg="black").pack()
7273
self.quit = Button(frame, text="QUIT", command=frame.quit).pack()
7374

@@ -81,29 +82,28 @@ def run_2(self):
8182

8283
def run_3(self):
8384
os.system(
84-
'pytest my_first_test.py --demo_mode'
85-
' --browser=chrome')
85+
'pytest my_first_test.py --browser=chrome --demo_mode')
8686

8787
def run_4(self):
8888
os.system(
89-
'nosetests test_fail.py --browser=chrome --demo_mode')
89+
'pytest parameterized_test.py --browser=chrome')
9090

9191
def run_5(self):
9292
os.system(
93-
'nosetests test_suite.py --report --show_report')
93+
'pytest test_fail.py --browser=chrome')
9494

9595
def run_6(self):
9696
os.system(
97-
'nosetests delayed_assert_test.py --browser=chrome')
97+
'pytest test_suite.py --browser=chrome --html=report.html')
9898

9999
def run_7(self):
100100
os.system(
101-
'nosetests test_suite.py'
102-
' --browser=chrome --with-db_reporting')
101+
'pytest test_delayed_asserts.py --browser=chrome')
103102

104103

105104
if __name__ == "__main__":
106105
root = Tk()
107-
root.minsize(532, 444)
106+
root.title("Select Test Job To Run")
107+
root.minsize(500, 420)
108108
app = App(root)
109109
root.mainloop()

0 commit comments

Comments
 (0)