New question #707102 on SikuliX:
https://answers.launchpad.net/sikuli/+question/707102
Hi,
I have a working htmltestrunner report I want to find out how do I display the
screenshot I saved on a failed test? I think I am using the htmltestrunner with
the screenshot for failed tests but when I run my code it doesn't seem to
display the screenshot on the report.
Here is the code from the htmltestrunner:
def addFailure(self, test, err):
self.failure_count += 1
TestResult.addFailure(self, test, err)
_, _exc_str = self.failures[-1]
output = self.complete_output()
self.result.append((1, test, output, _exc_str,
self.generateTestScreenshot(test))) # modified by RaiMan
if self.verbosity > 1:
sys.stderr.write('F ')
sys.stderr.write(str(test))
sys.stderr.write('\n')
else:
sys.stderr.write('F')
My script:
from sikuli import *
import sys
import HTMLTestRunner
import unittest
import shutil
class ReturnToHomePage(unittest.TestCase):
def testA_ReturnHome(self):
click(Location(300, 247))
wait(3)
click(Location(425, 489))
wait(5)
click(Location(92, 326))
wait(3)
screenshotsDir = "C:/Sikuli/ReturnHome.sikuli"
img = capture(Region(3,5,1021,760))
shutil.move(img, os.path.join(screenshotsDir, "1.png"))
assert exists(Images.homePage)
suite = unittest.TestLoader().loadTestsFromTestCase(ReturnToHomePage)
outfile = open('C:\jenkins\workspace\UAT\TestReport.html', 'w')
myrunner = HTMLTestRunner.HTMLTestRunner(stream=outfile, title='', description
='' )
myrunner.run(suite)
--
You received this question notification because your team Sikuli Drivers
is an answer contact for SikuliX.
_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to : [email protected]
Unsubscribe : https://launchpad.net/~sikuli-driver
More help : https://help.launchpad.net/ListHelp