1
1
'''
2
2
GUI TEST RUNNER
3
3
Run by Typing: "python gui_test_runner.py"
4
+ (Use Python 3 - There are GUI issues when using Python 2)
4
5
'''
5
6
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
12
7
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
13
13
14
14
15
15
class App :
16
16
17
17
def __init__ (self , master ):
18
- frame = Frame ()
18
+ frame = Frame (master )
19
19
frame .pack ()
20
- root .title ("Select Test Job To Run" )
21
20
self .label = Label (root , width = 40 ).pack ()
22
21
self .title = Label (frame , text = "" , fg = "black" ).pack ()
23
22
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 ()
25
24
self .run1 = Button (
26
25
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 ()
29
28
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 ()
31
30
self .run2 = Button (
32
31
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 ()
35
34
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 ()
37
36
self .run3 = Button (
38
37
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 ()
41
40
self .title4 = Label (
42
41
frame ,
43
- text = "Basic Failing Test Run with Screenshots :" ,
42
+ text = "Run a Parameterized Test :" ,
44
43
fg = "blue" ).pack ()
45
44
self .run4 = Button (
46
45
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 ()
49
48
self .title5 = Label (
50
49
frame ,
51
- text = "Basic Failing Test Suite Run with Test Report :" ,
50
+ text = "Run a Failing Test (automatic screenshots) :" ,
52
51
fg = "blue" ).pack ()
53
52
self .run5 = Button (
54
53
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 ()
56
56
self .title6 = Label (
57
57
frame ,
58
- text = "Basic Failing Test Run showing the Multiple-Checks feature :" ,
58
+ text = "Run a Failing Test Suite with a Test Report :" ,
59
59
fg = "blue" ).pack ()
60
60
self .run6 = Button (
61
61
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 ()
63
64
self .title7 = Label (
64
65
frame ,
65
- text = "Use MySQL DB Reporting: (See ReadMe.md for Setup Steps!) " ,
66
+ text = "Run a Failing Test with Delayed Asserts: " ,
66
67
fg = "blue" ).pack ()
67
68
self .run7 = Button (
68
69
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 ()
71
72
self .end_title = Label (frame , text = "" , fg = "black" ).pack ()
72
73
self .quit = Button (frame , text = "QUIT" , command = frame .quit ).pack ()
73
74
@@ -81,29 +82,28 @@ def run_2(self):
81
82
82
83
def run_3 (self ):
83
84
os .system (
84
- 'pytest my_first_test.py --demo_mode'
85
- ' --browser=chrome' )
85
+ 'pytest my_first_test.py --browser=chrome --demo_mode' )
86
86
87
87
def run_4 (self ):
88
88
os .system (
89
- 'nosetests test_fail .py --browser=chrome --demo_mode ' )
89
+ 'pytest parameterized_test .py --browser=chrome' )
90
90
91
91
def run_5 (self ):
92
92
os .system (
93
- 'nosetests test_suite .py --report --show_report ' )
93
+ 'pytest test_fail .py --browser=chrome ' )
94
94
95
95
def run_6 (self ):
96
96
os .system (
97
- 'nosetests delayed_assert_test .py --browser=chrome' )
97
+ 'pytest test_suite .py --browser=chrome --html=report.html ' )
98
98
99
99
def run_7 (self ):
100
100
os .system (
101
- 'nosetests test_suite.py'
102
- ' --browser=chrome --with-db_reporting' )
101
+ 'pytest test_delayed_asserts.py --browser=chrome' )
103
102
104
103
105
104
if __name__ == "__main__" :
106
105
root = Tk ()
107
- root .minsize (532 , 444 )
106
+ root .title ("Select Test Job To Run" )
107
+ root .minsize (500 , 420 )
108
108
app = App (root )
109
109
root .mainloop ()
0 commit comments