← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #165999]: Logging and reporting in project Sikuli

 

Question #165999 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/165999

Amutha Sreenivasan requested more information:
Hi Raiman,

         I a using HTMLTestrunner for reporting. 
In my situation , I have to rerun the test case several times. Everytime, when I rerun, In the report , it always updates the 1st table (Report file is opened in "append" mode) .  In this case, the report is not correct (i.e), it is not adding the failures to the correct row. Could you please give me the solution for this?

For logs, where to add above given lines for logging?

I added under, maintest.sikuli

import unittest
import logging
reload(logging)
logger = logging.getLogger("MyLogger")
logging.FileHandler("C:\Amutha\sikuli_logs\file.log","w")
logger.setLevel(logging.DEBUG)
logger.info("We are starting now")
import sample
reload (sample)
import HTMLTestRunner
suite = unittest.TestLoader().loadTestsFromTestCase(sample.UnitTestA)
unittest.TextTestRunner(verbosity=2).run(suite)
outfile = open("C:\Report.html", "a")
runner = HTMLTestRunner.HTMLTestRunner(stream=outfile, title='Test Report', description='This is demo' )
runner.run(suite)
outfile.close()
But it gives an error as 

[error] Error message: Traceback (most recent call last):
 File "C:\DOCUME~1\asreeniv\LOCALS~1\Temp\sikuli-tmp4440333128282933731.py", line 6, in 
 logging.FileHandler("C:\Amutha\sikuli_logs\file.log","w")
 File "C:\Program Files\Sikuli X\sikuli-script.jar\Lib\logging\__init__.py", line 770, in __init__
IOError: (13, 'Permission denied', 'C:\\Amutha\\sikuli_logs\x0cile.log')

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.