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

    Status: Answered => Open

DH is still having a problem:
Thanks for your answers, it is really appreciated. 
I did this: Created a brand new testfile.py

from sikuli import *
import unittest
import HTMLTestRunner


filSkapades = str(time.strftime(("%Y:%m:%d_%H:%M:%S")))
print filSkapades  
filnamn = 
"C:\\Sikuli\\Reports\\{}_Testraport_Filurmotionsmall.html".format(filSkapades.replace(':',
 '_'))

class MySimpleTest(unittest.TestCase):

    def test_StartPage(self):
        type( "\\Images\\windows_searchbar.png", 'Edge')
        click("\\Images\\windows_edge.png")
        type("\\Images\\edge_url_window.png", 'https://test.test.com/' + 
Key.ENTER)
        
        if exists("\\Images\\someImage.png"):
            assert True
        else:
            assert False
         
        m = find("\\Images\\edge_close.png")
        m.highlight(1)
        click(m.getTopRight())
      
      #I know this is wrong but when I put the instanciation of class inside 
the class, it just works
       suite = unittest.TestLoader().loadTestsFromTestCase(FilurTester)
      outfile = open(filnamn, "w")
      runner = HTMLTestRunner.HTMLTestRunner(stream=outfile, title=' Some 
testreport', description='More testing.' )
      runner.run(suite) 

When I run the script from Sikuli IDE, the testreport is now created.
But, when I run from command line I get the error:
NameError ( name 'MySimpleTest' is not defined )

And yes, I've put the 
HTMLTestRunner$py.class and HTMLTestRunner.py in the same folder as the sikuli 
script MySimpleTest.py. And also I put the files in 
C:\Users\MyUserProfile\AppData\Roaming\Sikulix\Lib
HTMLTestRunner$py.class and HTMLTestRunner.py


Some debug:
[DEBUG]startUp: IDE: Running: C:\Sikuli\sikulixide-2.0.4.jar
[DEBUG]startUp: IDE: AppData: C:\Users\MyUserProfile\AppData\Roaming\Sikulix
[DEBUG]startUp: IDE: starting with classpath: C:\Sikuli\sikulixide-2.0.4.jar ...
[DEBUG]startUp: IDE: no extensions.txt nor valid content
[DEBUG]startUp: IDE: adding extension file: 
C:\Users\MyUserProfile\AppData\Roaming\Sikulix\Extensions\jruby-complete-9.2.0.0.jar
[DEBUG]startUp: IDE: adding extension file: 
C:\Users\MyUserProfile\AppData\Roaming\Sikulix\Extensions\jython-standalone-2.7.1.jar
[414 debug] RunTime:temp folder ok: 
C:\Users\MyUserProfile\AppData\Local\Temp\Sikulix_1235572012
Options: *** options dump
Options: testing =
Options: OptionsFile = 
C:\Users\MyUserProfile\AppData\Roaming\Sikulix\SikulixStore\SikulixOptions.txt
Options: *** options dump end
***** show environment for 2.0.4-2020-03-14_08:01 API
user.home: C:\Users\MyUserProfile
user.dir (work dir): C:\
user.name: MyUserProfile
java.io.tmpdir: C:\Users\MyUserProfile\AppData\Local\Temp
running 64Bit(amd64) on w (10.0) from a jar
java 11 version 11 vm 11.0.8+10 class 55.0 arch 64
app data folder: C:\Users\MyUserProfile\AppData\Roaming\Sikulix
executing jar: C:\Sikuli\sikulixide-2.0.4.jar
*** classpath dump sikulix
  0: C:\Sikuli\sikulixide-2.0.4.jar
*** classpath dump end
***** show environment end
[DEBUG]startUp: IDE: *********************** leaving start
[84 debug] Sikulix: starting IDE
[142 debug] RunTime:temp folder ok: 
C:\Users\MyUserProfile\AppData\Local\Temp\Sikulix_736297173
Options: *** options dump
Options: testing =
Options: OptionsFile = 
C:\Users\MyUserProfile\AppData\Roaming\Sikulix\SikulixStore\SikulixOptions.txt
Options: *** options dump end
***** show environment for 2.0.4-2020-03-14_08:01 API
user.home: C:\Users\MyUserProfile
user.dir (work dir): C:\
user.name: MyUserProfile
java.io.tmpdir: C:\Users\MyUserProfile\AppData\Local\Temp
running 64Bit(amd64) on w (10.0) from a jar
java 11 version 11 vm 11.0.8+10 class 55.0 arch 64
app data folder: C:\Users\MyUserProfile\AppData\Roaming\Sikulix
executing jar: C:\Sikuli\sikulixide-2.0.4.jar
*** classpath dump sikulix
  0: C:\Sikuli\sikulixide-2.0.4.jar
  1: 
C:\Users\MyUserProfile\AppData\Roaming\Sikulix\Extensions\jruby-complete-9.2.0.0.jar
  2: 
C:\Users\MyUserProfile\AppData\Roaming\Sikulix\Extensions\jython-standalone-2.7.1.jar
*** classpath dump end
***** show environment end
[1561 debug] Runner: added: PackedSikulix [skl] text/skl
[1567 debug] Runner: added: NetworkRunner [] NET
[1568 debug] Runner: init: class 
org.sikuli.script.runners.AbstractLocalFileScriptRunner: warning: not possible
[1570 debug] Runner: added: SikulixJar [jar] text/jar
[1587 debug] Runner: added: Jython [py] text/jython
[1589 debug] Runner: added: PowerShell [ps1] text/powershell
[1590 debug] Runner: added: Text [txt] text/text
[1612 debug] Runner: added: JRuby [rb] text/ruby
[1614 debug] Runner: added: Sikulix [] directory/sikulix
[1615 debug] Runner: added: PackedSikulix [zip] application/zip
[2288 debug] Runner: added: JavaScript [js] text/javascript
[2310 debug] HotkeyManager: add Abort Hotkey: ALT+SKIFT C (67, 9)
[2631 debug] Runner: runscript: running script: 
C:\Sikuli\Scripts\MySimpleTest\MySimpleTest.py
[2638 debug] JythonRunner: starting initialization
[2643 debug] RunTime:resourceLocation: (class 
org.sikuli.script.support.RunTime) /Lib/sikuli
[2651 debug] RunTime:resourceList: having jar: 
jar:file:/C:/Sikuli/sikulixide-2.0.4.jar!/Lib/sikuli
[4591 debug] RunTime:files exported: 7 from: Lib/sikuli to:
 C:\Users\MyUserProfile\AppData\Roaming\Sikulix\Lib\sikuli
[9513 debug] Jython: added as Jython::sys.path[0]:
C:\Users\MyUserProfile\AppData\Roaming\Sikulix\Lib\site-packages
[9521 debug] Jython: ***** sys.path
 0: C:\Users\MyUserProfile\AppData\Roaming\Sikulix\Lib\site-packages
 1: C:\Users\MyUserProfile\AppData\Roaming\Sikulix\Lib
 2: C:\Users\MyUserProfile\AppData\Roaming\Sikulix\Extensions\Lib
 3: 
C:\Users\MyUserProfile\AppData\Roaming\Sikulix\Extensions\jython-standalone-2.7.1.jar\Lib
[9544 debug] JythonRunner: ready: version 2.7.1
[debug] Jython: SikulixForJython: init: starting
[debug] Jython: added as Jython::sys.path[0]:
C:\Users\MyUserProfile\AppData\Roaming\Sikulix\Lib\site-packages
[debug] Jython: SikulixForJython: init: success
[debug] Jython: sikuli: Sikuli: starting init
[debug] Screen: initScreens: starting
[debug] Screen: Accessing: GraphicsEnvironment.getLocalGraphicsEnvironment()
[debug] Screen: Accessing: 
GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()
[debug] Screen: ScreenDevice 0 has (0,0) --- will be primary Screen(0)
[debug] Screen: Monitor 0: (0, 0) 1920 x 1200
[debug] Mouse: init start
[debug] Mouse: init end
[debug] Screen: initScreens: ending
[debug] Jython: use as default region: R[0,0 1920x1200]@S(0)
[debug] Image: BufferedImage: (1920, 1200)
[debug] Jython: sikuli: Sikuli: ending init
[debug] Jython: use as default region: R[0,0 1920x1200]@S(0)
[debug] Image: BufferedImage: (1920, 1200)
[debug] ImagePath: new BundlePath: C:\Sikuli\Scripts\MySimpleTest
2020:11:06_15:26:22
[error] script [ MySimpleTest ] stopped with error in line 6
[error] NameError ( name 'MySimpleTest' is not defined )
[error] --- Traceback --- error source first
line: module ( function ) statement
27: main (  MySimpleTest )     suite = 
unittest.TestLoader().loadTestsFromTestCase(MySimpleTest)
6: main (  <module> )     class MySimpleTest(unittest.TestCase):
[error] --- Traceback --- end --------------
[debug] HotkeyManager: reset: removed all SikuliX hotkeys.
[debug] HotkeyController: stopping hotkey provider
[debug] RunTime:***** final cleanup at System.exit() *****
[debug] FileManager: deleteFileOrFolder:
C:\Users\MyUserProfile\AppData\Local\Temp\Sikulix_736297173
[20378 debug] RunTime:***** final cleanup at System.exit() *****
[20447 debug] FileManager: deleteFileOrFolder:
C:\Users\MyUserProfile\AppData\Local\Temp\Sikulix_1235572012


Arrrggggghhhh,  :-)

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

_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to     : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp

Reply via email to