I need to generate HTML report using screenshot

Asked by Vishal singh on 2018-02-21

@ Raiman

i need to generate html reports with screenshots
I looked into the question 250286 and i understood what i need to add to the code to take the screen shot

**i cant access this modified version link --

i did this changes in my current HTMLTestRunner
def addSuccess(self, test):
        self.success_count += 1
        TestResult.addSuccess(self, test)
        output = self.complete_output()
        self.result.append((0, test, output, ''))
        if self.verbosity > 1:
            sys.stderr.write('ok ')

    def addError(self, test, err):
        self.error_count += 1
        TestResult.addError(self, test, err)
        _, _exc_str = self.errors[-1]
        output = self.complete_output()
        self.result.append((2, test, output, _exc_str, self.generateTestScreenshot(test)))
        if self.verbosity > 1:
            sys.stderr.write('E ')

    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 ')

please tell me what to change in here:

class ImportProject(unittest.TestCase):

    def setUp(self):

    def tearDown(self):

    def test1():

    def test2():

suite = unittest.TestLoader().loadTestsFromTestCase(importProject)
outFile = open("report.html", "w")
runner = HTMLTestRunner.HTMLTestRunner(stream=outFile, title='test report', description='test case description' )

please tell me if i am doing something wrong

Thanks in advance

Question information

English Edit question
Sikuli Edit question
No assignee Edit question
Last query:
Last reply:
RaiMan (raimund-hocke) said : #1

SikuliX 1.1.1+:
HTMLTestRunner is bundled.

Vishal singh (vishalsingh5900) said : #2

I am using Sikuli 1.1.1

HTMLTestRunner is bundled ?
I actually didnt understood this can you please explain in detail
or any short example
i would really appreciate the help

sorry if this is bothering you much


RaiMan (raimund-hocke) said : #3

Just import.

Can you help with this problem?

Provide an answer of your own, or ask Vishal singh for more information if necessary.

To post a message you must log in.