Ich versuche, einige automatisierte Tests auf einer Swing-basierten Java-Anwendung mit der Swing-Bibliothek des Robotframeworks auszuführen. Ich denke, ich habe alle Bibliotheken installiert. Wenn ich den Test jedoch ausführe, kann er die Anwendung nicht ordnungsgemäß starten (d. H. Die Fehlertests), und ich bekomme eine ganze Reihe von Warnungen (?), Bevor der Test tatsächlich gestartet wird. Außerdem sehe ich kurz das Java-Icon auf dem Dock, aber tatsächlich öffnet sich kein Fenster.Swing Anwendung wird nicht gestartet, wenn versucht wird, mit Robotframework zu testen
Ich habe kein Problem mit dem Testen der Demo-Anwendung here obwohl. Das funktioniert gut.
unter meinem Roboter Skript ist:
*** settings ***
Library SwingLibrary
*** Test Cases ***
Test Push Button
Start Test Application
*** Keywords ***
Start Test Application
Start Application com.xyz.app.ui.MainFrame
Select Main Window
Hier ist der Ausgang:
davids$ sudo CLASSPATH=lib/swinglibrary-1.5.1.jar:app.jar jybot app.robot
Password:
10:31:34.578 [MainThread] DEBUG o.p.n.u.i.l.InternalLoggerFactory - Using SLF4J as the default logging framework
10:31:34.613 [MainThread] DEBUG o.p.n.u.internal.PlatformDependent0 - java.nio.Buffer.address: available
10:31:34.613 [MainThread] DEBUG o.p.n.u.internal.PlatformDependent0 - sun.misc.Unsafe.theUnsafe: available
10:31:34.614 [MainThread] DEBUG o.p.n.u.internal.PlatformDependent0 - sun.misc.Unsafe.copyMemory: available
10:31:34.615 [MainThread] DEBUG o.p.n.u.internal.PlatformDependent0 - java.nio.Bits.unaligned: true
10:31:34.616 [MainThread] DEBUG o.p.n.u.internal.PlatformDependent - Java version: 8
10:31:34.616 [MainThread] DEBUG o.p.n.u.internal.PlatformDependent - -Dio.netty.noUnsafe: false
10:31:34.616 [MainThread] DEBUG o.p.n.u.internal.PlatformDependent - sun.misc.Unsafe: available
10:31:34.617 [MainThread] DEBUG o.p.n.u.internal.PlatformDependent - -Dio.netty.noJavassist: false
10:31:34.697 [MainThread] DEBUG o.p.n.u.internal.PlatformDependent - Javassist: available
10:31:34.698 [MainThread] DEBUG o.p.n.u.internal.PlatformDependent - -Dio.netty.tmpdir: /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T (java.io.tmpdir)
10:31:34.698 [MainThread] DEBUG o.p.n.u.internal.PlatformDependent - -Dio.netty.bitMode: 64 (sun.arch.data.model)
10:31:34.698 [MainThread] DEBUG o.p.n.u.internal.PlatformDependent - -Dio.netty.noPreferDirect: false
10:31:34.698 [MainThread] DEBUG o.p.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.numHeapArenas: 4
10:31:34.699 [MainThread] DEBUG o.p.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.numDirectArenas: 4
10:31:34.699 [MainThread] DEBUG o.p.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.pageSize: 8192
10:31:34.699 [MainThread] DEBUG o.p.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxOrder: 11
10:31:34.699 [MainThread] DEBUG o.p.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.chunkSize: 16777216
10:31:34.699 [MainThread] DEBUG o.p.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.tinyCacheSize: 512
10:31:34.699 [MainThread] DEBUG o.p.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.smallCacheSize: 256
10:31:34.699 [MainThread] DEBUG o.p.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.normalCacheSize: 64
10:31:34.699 [MainThread] DEBUG o.p.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxCachedBufferCapacity: 32768
10:31:34.699 [MainThread] DEBUG o.p.n.buffer.PooledByteBufAllocator - -Dio.netty.allocator.cacheTrimInterval: 8192
10:31:34.720 [MainThread] DEBUG o.p.n.c.MultithreadEventLoopGroup - -Dio.netty.eventLoopThreads: 8
10:31:34.768 [MainThread] DEBUG o.p.netty.channel.nio.NioEventLoop - -Dio.netty.noKeySetOptimization: false
10:31:34.768 [MainThread] DEBUG o.p.netty.channel.nio.NioEventLoop - -Dio.netty.selectorAutoRebuildThreshold: 512
==============================================================================
app
==============================================================================
Test Push Button | FAIL |
com.xyz.app.ui.MainFrame
------------------------------------------------------------------------------
app | FAIL |
1 critical test, 0 passed, 1 failed
1 test total, 0 passed, 1 failed
==============================================================================
Output: /Users/davids/swinglibrary-demo/output.xml
Log: /Users/davids/swinglibrary-demo/log.html
Report: /Users/davids/swinglibrary-demo/report.html
Auch habe ich, dass die app.jar Datei den Pfad der Mainframe-Klasse enthält in der Tat überprüft : com/xyz/app/ui/MainFrame.class
UPDATE: "Anwendung starten In separaten Thread" Schlüsselwort anstelle von "Start Application" gibt einen neuen Fehler. Es scheint, dass es nicht die Hauptklasse finden kann, auch wenn ich manuell den Pfad der Hauptklasse bestätigt haben, indem Sie die JAR-Datei entpacken .:
Exception in thread "Thread-14" java.lang.RuntimeException: java.lang.ClassNotFoundException: com.xyz.app.ui.MainFrame at org.robotframework.swing.keyword.launch.ApplicationLaunchingKeywords$1.run(ApplicationLaunchingKeywords.java:53) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.ClassNotFoundException: com.xyz.app.ui.MainFrame at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:264) at org.robotframework.swing.keyword.launch.ApplicationLaunchingKeywords.getMainMethod(ApplicationLaunchingKeywords.java:64) at org.robotframework.swing.keyword.launch.ApplicationLaunchingKeywords.launchApplication(ApplicationLaunchingKeywords.java:32) at org.robotframework.swing.keyword.launch.ApplicationLaunchingKeywords$1.run(ApplicationLaunchingKeywords.java:51) ... 1 more
Wird 'sudo' wirklich benötigt? (nur ... wundernd) –
@HuguesMoreau Nicht wirklich. Übrigens, ich habe meinem ursprünglichen Beitrag ein Update hinzugefügt, falls Sie interessiert sind. – rocketfinger