sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #19100
Re: [Question #226284]: Rectangle With and lenght must be >0
Question #226284 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/226284
Chris posted a new comment:
here is a copy of the final(working) script with the modifications,
incase anyone else running into this needs further help.
from sikuli import*
from datetime import date
from datetime import datetime
import unittest
import HTMLTestRunner
class BDTests(unittest.TestCase):
app = App("C:\\Program Files (x86)\\Microsoft Office\\Office14\\WINWORD.exe")
def setUp(self):
self.app.open()
wait(7)
def tearDown(self):
find("1372966713962.png")
self.app.close()
wait(2)
def test_aInitialization(self):
sleep(2)
click(Pattern("1372188351692.png").similar(0.05))
wait(5)
if exists("Ready-1.png"):
assert True
else:
assert False
def test_bSavingFavorite(self):
sleep(2)
click(Pattern("1372188351692.png").similar(0.05))
wait(8)
click("II.png")
wait(3)
doubleClick("SaveFavourit.png")
wait(5)
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_cDeletingafavorite(self):
sleep(2)
click(Pattern("1372188351692.png").similar(0.05))
wait(8)
click("1-1.png")
wait(3)
click(Pattern("1365519420122.png").targetOffset(-13,0))
wait(4)
rightClick("blarg.png")
click("Delete.png")
wait(5)
click("1.png")
wait(2)
if exists("TEST2.png"):
assert False
else:
assert True
#shutil.move(img,"C:\Users\testuser454\Documents\Fail Screenshot - " + datetime.now().strftime("%b %Y %I.%M %p") + ".png")
suite = unittest.TestLoader().loadTestsFromTestCase(BDTests)
#Use with: to ensure the file is closed when we're done
with open("C:\\Users\\testuser454\\Documents\\Test Results - " + datetime.now().strftime("%Y-%m-%d %H.%M") + ".html","w") as outfile:
runner = HTMLTestRunner.HTMLTestRunner(stream=outfile,title='Test Report',description='this is a demo')
runner.run(suite)
I still need to split up the test cases from the main script into smaller peices so i can import them into the main one and also setup the screenshots when it fails but this worked for me and i use it as a template to build more test.
Thanks again for your help RaiMan!
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.