sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #29820
[Question #259679]: Failure Screenshots with timestamp
New question #259679 on Sikuli:
https://answers.launchpad.net/sikuli/+question/259679
@Raiman:
I am using your modified version of html test runner which takes screenshots on failures.
The thing is screenshots are replaced and overwritten on every run of the sikuli report.
Can you help me to keep the failure screenshot names unique with a timestamp or something? so that the previous screenshots will not be overwritten and i can keep those for future reference.
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)))
if self.verbosity > 1:
sys.stderr.write('F ')
sys.stderr.write(str(test))
sys.stderr.write('\n')
else:
sys.stderr.write('F')
Do i have to make any modifications in html test runner?
# added by RaiMan
def generateTestScreenshot(self, test):
imgdir = self.dirTestScreenshots
imgpath = ''
if imgdir:
x = str(test).split()
tf = x[0]
tc = x[1].split('.')[1][:-1]
imgpath = os.path.join(imgdir, "%s-%s.png"%(tc, tf))
shutil.move(capture(SCREEN), imgpath)
return imgpath
Thanks in Advance!!
Cheers :)
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.