Skip to content

Commit e93749e

Browse files
author
Harsh Murari
committed
Additional test cases
1 parent b948bc4 commit e93749e

File tree

4 files changed

+81
-12
lines changed

4 files changed

+81
-12
lines changed

settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"Host": "10.85.4.251",
2+
"Host": "..",
33
"Port": 8080,
44
"StartDir" : "."
55
}

test_gui.py

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,56 @@
22
import unittest
33
import time
44

5+
def get_sky_color():
6+
return 'blue'
7+
8+
def is_water_wet():
9+
return True
10+
511
class TestGUIFunction(unittest.TestCase):
612
def test_print_1_many_times(self):
7-
for i in range(0,10):
8-
time.sleep(1)
13+
'''Just print 1's'''
14+
for i in range(0, 5):
15+
time.sleep(0.5)
916
print(i, ".. GUI verification")
1017

1118
def test_print_2_many_times(self):
19+
'''More GUI verification'''
1220
for i in range(0,10):
21+
time.sleep(0.1)
1322
print(i, ".. More GUI verification")
1423

1524
def test_failure_1(self):
25+
'''Test a failure scenario'''
1626
print('Testing for a failure scenario.')
1727
for i in range(0,10):
28+
time.sleep(0.1)
1829
print(i, ".. GUI verification")
1930
print('Asserting now..')
2031
assert(0)
2132

2233
def test_long_running_1(self):
23-
for idx in range(0, 20):
24-
print('Testing long running test case.. ', idx)
25-
time.sleep(.5)
34+
'''Sort of long running test case'''
35+
for idx in range(0, 5):
36+
print('Testing a sort of long running test case.. ', idx)
37+
time.sleep(.2)
38+
39+
def test_sky_is_blue(self):
40+
'''Another filler test'''
41+
print('Testing sky is blue')
42+
time.sleep(0.2)
43+
assert 'blue' == get_sky_color(), 'Ooops.. sky is not blue'
44+
45+
def test_water_is_wet(self):
46+
'''Another filler test'''
47+
print('Testing if water is wet')
48+
time.sleep(0.2)
49+
assert True == is_water_wet(), 'Ooops.. water doesn\'t seem to be wet'
50+
51+
def test_failure_scenario2(self):
52+
'''Additional failure test to make UI look pretty'''
53+
print('Testing failure scenario 2')
54+
time.sleep(0.2)
55+
assert 0, 'Okay this was expected failure.'
56+
2657

test_gui2.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
2+
import unittest
3+
import time
4+
5+
def get_sky_color():
6+
return 'blue'
7+
8+
def is_water_wet():
9+
return True
10+
11+
class TestPyTestGui2(unittest.TestCase):
12+
def test_new_things_here(self):
13+
'''Just print 1's'''
14+
for i in range(0, 5):
15+
time.sleep(0.5)
16+
print(i, ".. New things verification")
17+
18+
def test_more_new_things(self):
19+
'''More GUI verification'''
20+
for i in range(0,10):
21+
time.sleep(0.1)
22+
print(i, ".. More new things GUI verification")
23+
24+
def test_new_failures(self):
25+
'''Test a failure scenario'''
26+
print('Testing for a new failure scenario')
27+
for i in range(0,10):
28+
time.sleep(0.1)
29+
print(i, ".. GUI verification")
30+
print('Asserting now..')
31+
assert(0)
32+
33+
def test_new_long_run(self):
34+
'''Sort of long running test case'''
35+
for idx in range(0, 5):
36+
print('Testing a sort of long running test case.. ', idx)
37+
time.sleep(.2)
38+

view.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def __init__(self, root):
6161

6262
# Root window
6363
self.root = root
64-
self.root.title('ASD Test Interface')
64+
self.root.title('GUI Test Runner')
6565
self.root.geometry('1024x768')
6666
self.root.option_add('*tearOff', FALSE)
6767

@@ -277,16 +277,16 @@ def _setup_right_frame(self):
277277
self.content.add(self.details_frame)
278278

279279
# Add support instrument IP Address.
280-
self.instrument_ip_address_label = Label(self.details_frame, text = "Instrument IP:")
281-
self.instrument_ip_address_label.grid(column=0, row=0, sticky=(W))
280+
self.instrument_ip_address_label = Label(self.details_frame, text = "Meta Data")
281+
# self.instrument_ip_address_label.grid(column=0, row=0, sticky=(W))
282282

283283
self.instr_ip_addr = StringVar()
284284
self.instr_ip_addr_widget = Entry(self.details_frame, textvariable= self.instr_ip_addr, width=60)
285285
self.instr_ip_addr.set(get_setting('Host') or 'Not Found')
286-
self.instr_ip_addr_widget.grid(column=1, row=0, sticky=(W))
286+
# self.instr_ip_addr_widget.grid(column=1, row=0, sticky=(W))
287287

288-
self.reload_ip_address = Button(self.details_frame, text='Update IP Address', command=self.cmd_load_ip_address)
289-
self.reload_ip_address.grid(column=1, row=0, sticky=(E))
288+
self.reload_ip_address = Button(self.details_frame, text='Update Meta', command=self.cmd_load_ip_address)
289+
# self.reload_ip_address.grid(column=1, row=0, sticky=(E))
290290

291291
# Add label for test directory
292292
self.testdir_label = Label(self.details_frame, text="Test Directory:")

0 commit comments

Comments
 (0)