-
Notifications
You must be signed in to change notification settings - Fork 17
/
test_calc.py
34 lines (26 loc) · 918 Bytes
/
test_calc.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
#This file was originally generated by PyScripter's unitest wizard
import sys, os, re, time
import unittest
import msaa
import comtypes.client
AutoItX = comtypes.client.CreateObject('AutoItX3.Control')
class TestCalc(unittest.TestCase):
def setUp(self):
os.startfile('calc.exe')
time.sleep(3)
def tearDown(self):
AutoItX.WinClose('Calculator')
def testcalc(self):
w = msaa.window('Calculator')
b1 = w.find('PushButton', Name='1')
b1.accDoDefaultAction()
ba = w.find('PushButton', Name='Add')
ba.accDoDefaultAction()
b2 = w.find('PushButton', Name='2')
b2.accDoDefaultAction()
be = w.find('PushButton', Name='Equals')
be.accDoDefaultAction()
e = w.find('Text', Name=u'Result')
assert e.accValue() == u'3 '
if __name__ == '__main__':
unittest.main()