← Back to team overview

sikuli-driver team mailing list archive

[Question #251460]: Facing problem in generating reports through HTMLTestRunner

 

New question #251460 on Sikuli:
https://answers.launchpad.net/sikuli/+question/251460

Can you please give a simple example for generating reports through HTMLTestRunner
A small example like, opening the calculator, do small addition and close it.
I have tried with all the answers you provided in last queries(asked by other users) and studied the document suggested by you:
https://docs.python.org/2/library/unittest.html
I hope that you give an example for generating reports, as I’m a tester so having less knowledge in coding that’s why I didn’t get much knowledge from the doc provided by you but I tried the script. Here is my script.

import unittest
import HTMLTestRunner

class Test(unittest.TestCase): 
    def setUp(self):
        openApp("system32\\calc.exe")
        wait("1404975041498-1.png")
    def tearDown(self):
        closeApp("system32\\calc.exe")    
      
    def testA(self):
        click("1404985458315.png")
        click("1404985487526.png")
        click("1404985502302.png")
        click("1404985577471.png")
        assert exists("1404985559335.png")
        print "Test case Pass"

    def testB(self):
        assert not exists("1404985559335.png")
        print "Test case Fail"     
suite = unittest.TestLoader().loadTestsFromTestCase(Test)
outfile = open("PATH OF HTML FILE", "w")
runner = HTMLTestRunner.HTMLTestRunner(stream=outfile, title='Test Report', description='This is demo' )
runner.run(suite)

with this script I’m unable to generate the report

My questions and issues I’m facing

Question1:
When I used “import HTMLTestRunner” I’m getting the following error message:
ImportError ( No module named HTMLTestRunner ) 
 For this the solutions that I have tried are:
I have placed the HTMLTestRunner.py file in the same directory where sikuli.sikuli script file is residing.
Also I have placed the HTMLTestRunner.py file in a folder where ‘sikuli-setup.jar file is residing
Note: when I opened the HTMLTestRunner.py file its opening in note pad.

Question 2:
What is unittest in ‘import unittest’ statement
Was ‘unittest’ means another script.
Will this statement work in Sikuli IDE even if we are not using python/jython

Question 3:
For storing results the process which I’m following is 
Taking a Notepad converting it to html file and giving this file properties in output file
i.e. outfile = open("C:\\Users\\PamTen\\Desktop\\results.html", "w")

was this process correct?


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