← Back to team overview

sikuli-driver team mailing list archive

[Question #693855]: NameError name 'ClassName' is not defined

 

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

Hi,
I've a problem. I rin Sikuli 2.0.4, this is my use case:

File located under: C:\Sikuli\Scripts\Mytests.sikuli\ClassName.py

filename = ClassName.py


from sikuli import *
import unittest
import HTMLTestRunner

class ClassName(unittest.TestCase):
    
    fileCreate = str(time.strftime(("%Y:%m:%d_%H:%M:%S")))
    fileName = "C:\\Sikuli\\Reports\\{}_Testreport_MyReport.html".format(fileCreate.replace(':', '_'))

    
    
    def test_StartPage(self):
        type( "\\Images\\windows_searchbar.png", 'Edge')
        click("\\Images\\windows_edge.png")
        assert False

    suite = unittest.TestLoader().loadTestsFromTestCase(ClassName)
    outfile = open(fileName, "w") 
    runner = HTMLTestRunner.HTMLTestRunner(stream=outfile, title=' My report Title', description='Some desc..' )
    runner.run(suite)  

When I run the test I get:

[error] script [ ClassName ] stopped with error in line 5
[error] NameError ( name 'ClassName' is not defined )
[error] --- Traceback --- error source first
line: module ( function ) statement 
60: main (  ClassName )     suite = unittest.TestLoader().loadTestsFromTestCase(ClassName)
5: main (  <module> )     class ClassName(unittest.TestCase):
[error] --- Traceback --- end --------------


What am I doing wrong here?


-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.