sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #17721
Re: [Question #176005]: [HowTo] Nice unit test runner with html output
Question #176005 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/176005
Chris posted a new comment:
Great thanks :D that worked but now the script just says EEE time
elapsed 0:00:00... I really love sikuli it will be awesome for non-
coder-testers, sry for all the bother but is there anything i'm just
missing?Here is a print out of my script, hope you don't mind me posting
this large post...
import unittest
import HTMLTestRunner
#first we need to define any applications we want to use and their location
app = App("C:\\Program Files (x86)\\Microsoft Office\\Office14\\WINWORD.exe")
def setUp(self):
#open app
self.app.open()
#wait until initialized
wait(7)
#tear down happens after tests compelte and should close anything that was opened
def tearDown(self):
#close app
self.app.close()
#slight delay for safety(probably nto needed)
wait(2)
#set up method will happen before tests
class BDTests(unittest.TestCase):
#each test needs to start with test
def test_cInitialization(self):
#using regions improves performance and reduces the chance of errors
# because the same UI component exists elsewhere
with self.app.window():
wait(2)
wait(Pattern("SelectEditin.png").targetOffset(21,1),5)
click(Region(1647,139,24,21))
wait("Ready-1.png")
if not exists("Ready-1.png"):
assert False
else:
assert True
def test_bSavingFavorite(self):
with self.app.window():
#wait(5)
click(Region(1648,140,24,22))
wait(6)
click(Pattern("1365194458088.png").targetOffset(-1,0))
wait(2)
doubleClick("SaveFavourit.png")
click("Name-1.png")
type("blarg")
click("1365453234338.png")
wait(2)
click("ClassifyifTr.png")
wait(2)
click(Pattern("TEST2.png").targetOffset(-16,1))
if not exists("blarg.png"):
assert False
else:
assert True
def test_aDeletingafavorite(self):
with self.app.window():
wait(4)
click(Pattern("FindiscRepla.png").targetOffset(42,47))
wait(5)
click(Pattern("1.png").targetOffset(-1,-1))
wait(2)
click(Pattern("1365519420122.png").targetOffset(-13,0))
wait(4)
rightClick("blarg.png")
click("Delete.png")
wait(5)
click("1.png")
wait(2)
if not exists("TEST2.png"):
assert False
else:
assert True
suite = unittest.TestLoader().loadTestsFromTestCase(BDTests)
outfile = open("C:\\Users\\testuser454\\Documents\\results.html","w")
runner = HTMLTestRunner.HTMLTestRunner(stream=outfile,title='Test Report demo',description='Test description')
runner.run(suite)
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.