← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #207167]: Empty report - HTMLTestRunner through command line

 

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

RaiMan proposed the following answer:
I cannot confirm your finding.

This worked for me as expected:

import unittest
import HTMLTestRunner
import os

class SuiteA(unittest.TestCase):
    def setUp(self):
        print "in setUp"
    def tearDown(self):
        print "in tearDown"

    def A(self):
       print "test A"
    def B(self):
       print "test B"
                
def suite():
    suite = unittest.TestSuite()
    suite.addTest(SuiteA('A'))
    suite.addTest(SuiteA('B'))
    return suite

suite = suite()

timestamp = time.strftime('%Y_%m_%d_%H_%M')
rname = 'MyReport_'+timestamp+'.html'
base_dir = os.path.join(os.path.dirname(getBundlePath()), 'log')
report_file = os.path.join(base_dir, rname)

outfile = open(report_file, "w")
runner = HTMLTestRunner.HTMLTestRunner(
        stream=outfile,
        title=rname,
        description='bla bla'
        )
runner.run(suite)
outfile.close()

and produced this report:
https://dl.dropbox.com/u/42895525/HTMLTestRunnerExample.png

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