sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #45703
Re: [Question #663899]: HTML reports shows pass even if the test Fails in Sikuli
Question #663899 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/663899
Description changed to:
Hi
I am new to sikuli and currently automating my Desktop application
I am writing a script to check if the image is present on the application or not and generating the HTML report
But the report always shows the tests pass even if i close the application to check if it shows fail or not
Please tell me how to solve this error
Thank you in advance
Here is the code:
import os
import HTMLTestRunner
import unittest
import sys
import logUtils
logger = logUtils.createLog(r'C:\Tools\td5_gui_automation\Test_logs\toolbar_test.log')
class Util(unittest.TestCase):
def setUp(self):
# setup the test environment needed to execute the tests in this function
try:
TD5 = os.popen(r"C:\Tools\TD5\start_td5_adas_net.lnk")
wait(30)
if exists("1516275912874.png"):
logger.info("TD5 started")
else:
logger.error('Unable to launch TD5')
except Exception, e:
str(e)
logger.error(e)
def tearDown(self):
# After completion of the tests tear down exits the application
try:
if exists("1516275912874.png"):
click(Pattern("1517330159528.png").targetOffset(19,-29))
logger.info("Exiting TD5")
else:
logger.error('Unable to exit TD5')
except Exception:
print Exception
def test_newProjectButton(self):
try:
logger.info("Checking new project button on toolbar")
if exists("1516275912874.png"):
click(Pattern("1517328688615.png").similar(0.80).targetOffset(-9,1))
logger.info("Clicked on new button on toolbar")
wait(2)
if exists(Pattern("1517330266749.png").similar(0.90)):
logger.info("New project dialogue successfully started")
click("1517330523887.png")
assert True
else:
logger.error("Unable to start New project import wizard")
assert False
else:
logger.error("Unable to click on new button in toolbar")
except Exception, e:
str(e)
logger.error(e)
suite = unittest.TestLoader().loadTestsFromTestCase(Util)
outFile = open(r"C:\Tools\td5_gui_automation\Test_reports\toolbar_test.html", "w")
runner = HTMLTestRunner.HTMLTestRunner(stream=outFile, title='test report', description='Testing all toolbar icons on TD5 GUI' )
runner.run(suite)
HTML report:
It shows pass in the report and when i click pass it shows me this
pt1.1: Traceback (most recent call last):
File "C:\Tools\td5_gui_automation\SikuliX\sikulix.jar\Lib\logging\__init__.py", line 874, in emit
stream.write(fs % msg)
File "C:\Tools\td5_gui_automation\SikuliX\sikulix.jar\Lib\logging\__init__.py", line 874, in emit
stream.write(fs % msg)
ValueError: I/O operation on closed file
Logged from file ToolbarUtil.py, line 18
.... repeated
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.