Reporting

Asked by Ankit Jain on 2012-07-18

HTMLTestRunner report always showing previous reports, its not updating for other test suites.
Is there any other method of reporting rather than html test runner or xml test runner????

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
2012-07-18
Last query:
2012-07-18
Last reply:
2012-07-18

This question was reopened

Ankit Jain (ankit4655) said : #1

Ankit Jain suggests this article as an answer to your question:
FAQ #1778: “Logging and reporting in Sikuli scripts”.

Ankit Jain (ankit4655) said : #2

HTMLTestRunner report always showing previous reports, its not updating for other test suites.
Is there any other method of reporting rather than html test runner or xml test runner????

RaiMan (raimund-hocke) said : #3

When talking about XXX-testRunner, then we are talking about unit testing.

This has nothing to do with the above mentioned faq.

--- HTMLTestRunner report always showing previous reports, its not updating for other test suites
pls. paste your script, to know your usage.

Ankit Jain (ankit4655) said : #4

I need HTML report for the below script.

import unittest
import HTMLTestRunner
class TestA(unittest.TestCase):
    def setUp(self):
        openApp("C:\\Program Files\\Microsoft Office\\Office14\\WINWORD.EXE")
        while not exists("Pr00fGuru-1.png"):
            sleep(5)
click("Pr00fGuru.png")
click("Starthacking.png")
while not exists("SignInEmailI.png"):
    sleep(5)
click("EmailID.png")
type("<email address hidden>\t")
type("testing")
click("1342006158928.png")
while not exists("DocumenttcCh.png"):
    sleep(5)
click("1342006353152.png")
wait(2)
click("1342006421355.png")
wait(4)
type("JDBC Parameterization\n")
click("Tra.png")
click("li_Ul.png")
click("1342007231083.png")
while not exists("Selectasugge.png"):
    sleep(5)
for x in findAll("1342007467656.png"):
    click(x)
wait(1)
click("E.png")
exists("__SIKULI-CAPTURE-BUTTON__")
while not exists("Selectssugge.png"):
    sleep(5)
click("1342070753716.png")
wait("Doyouwacance.png",7)
click("Yes.png")
wait("CheckingDocu.png",7)
click("OK.png")
def testrun(self):
        print("ABC")
suite=unittest.TestLoader().LoadTestsFromTestCase(TestA)
outfile=open("c:\testreport.html","wb")
runner=HTMLTestRunner.HTMLTestRunner(stream=outfile,title='test report',description='demo')
runner.run(suite)
outfile.close()

i m always getting same error
ft1.1: Traceback (most recent call last):
  File "C:\Users\ankit\AppData\Local\Temp\sikuli-tmp3018902706987125602.py", line 13, in setUp
    click("EmailID.png")
FindFailed: FindFailed: can not find EmailID.png on the screen.
  Line 7, in file C:\Users\ankit\AppData\Local\Temp\sikuli-tmp3018902706987125602.py

Best RaiMan (raimund-hocke) said : #5

--- i m always getting same error
It is a FindFailed error, saying, that sikuli cannot find the image "EmailID.png" on the screen (timing problem?)

--- your script looks strange
... since the block between the last statement of the class definition
           sleep(5)
and
def testrun(self):

has no indentation, so it belongs to the main script and is run before the last code block
suite=unittest.TestLoader().LoadTestsFromTestCase(TestA)
outfile=open("c:\testreport.html","wb")
runner=HTMLTestRunner.HTMLTestRunner(stream=outfile,title='test report',description='demo')
runner.run(suite)
outfile.close()

which only executes the setUp() in TestA and then prints ABC.

So I guess, the above mentioned block of code should be a def testXXX, that should be run by the test runner after the setup() (since this opens your application).

Ankit Jain (ankit4655) said : #6

Thanks RaiMan :)
that was indentation problem.

Ankit Jain (ankit4655) said : #7

Thanks RaiMan, that solved my question.