To create a Test List that could have multiple Test suite and generate a report throuhg the HTMLTestRunner usage

Asked by Sandhya

Hello,

I am trying to create a Test list to which I need to add test suites and then generate reports through HTMLTestRunner in Sikuli.We excute this through Command Prompt .

My Test Suite are in the folder :- "c://SikuliX"

C:/Sikulix/AddCredit.Sikuli
C:/Sikulix/XYZ.Sikuli
C:/Sikulix/DEF.Sikuli

I now need to create a Test List with these 3 test suite added to it and generate a report through HTMLTestRunner. For the moment I am only trying to add one Test suite "AddCredit" to the Test List and generate the Report.

Please find the code/script below that should both generate the Test list by adding the "AddCredit" suite to it and generate the Report.

sikuliPath = "C:\\SikuliX"
if not sikuliPath in sys.path: sys.path.append(sikuliPath)
import sys

import HTMLTestRunner
reload(HTMLTestRunner)
import unittest

def RunSuite(testCase):
    outfile = open("C:\\Results\\Results.html", "w")
    runner = HTMLTestRunner.HTMLTestRunner(stream=outfile, title='Tests Executed', description='Suite with all tests')
    runner.run(suite)

import AddCredit
testCaseForUITests=AddCredit
suite=unittest.TestSuite()
suite.addTest(unittest.TestLoader().loadTestsFromTestCase(testCaseForUITests))
RunSuite()

Exit

Issues:

1) We are getting the following error
[error] TypeError ( issubclass() arg 1 must be a class ) at the line where the code "testCaseForUITests=AddCredit " is written.

I have read in some forums that we need to call the method within the test suite (in my case method with AddCredit) to run them. My Sikuli file AddCredit doesn't have any methods as script written in them directly perform the operation.

2)
When I excute the AddCredit it excutes correctly but if need to add it to TestList and generate the HTML report We are facing issue reported ablve.

Please advise.

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

the content of a Python module or .sikuli, that is intended to be used with unittest.TestLoader must conform to the requirements of class unittest.TestCase

see faq 1804 for the basics and the Python docs for the details.

Can you help with this problem?

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

To post a message you must log in.