SWTBot Headless/Commandline Execution Failed [message #1329010] |
Fri, 02 May 2014 20:26  |
Eclipse User |
|
|
|
Hi
I am trying to execute a sample SWT test application using SWTBot headless environment. The objective is to run the tests via command line.
I have used ant script to run the tests. But, I don't see the test launches the application. I got the error "Could not find IExtension for application: ".
Not sure whether the application plugin should be copied anywhere. When I run the tests via Eclipse IDE, I can able to run the tests without any problem.
I am new to SWTBot tool.
Thanks.
Here is the log file contents.
!SESSION 2014-05-03 01:04:10.074 -----------------------------------------------
eclipse.buildId=4.3.2.M20140221-1700
java.version=1.7.0_40
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_GB
Framework arguments: -application org.eclipse.swtbot.eclipse.junit.headless.swtbottestapplication -classNames com.example.rcpmain.swtbot.tests.Tester -product com.example.rcpmain.rcpmain -testpluginname com.example.rcpmain.swtbot.tests -version 3 -loaderpluginname org.eclipse.jdt.junit.runtime -testApplication com.example.rcpmain.application -testLoaderClass org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader -loaderpluginname org.eclipse.jdt.junit4.runtime
Command-line arguments: -application org.eclipse.swtbot.eclipse.junit.headless.swtbottestapplication -classNames com.example.rcpmain.swtbot.tests.Tester -product com.example.rcpmain.rcpmain -testpluginname com.example.rcpmain.swtbot.tests -version 3 -loaderpluginname org.eclipse.jdt.junit.runtime -testApplication com.example.rcpmain.application -data C:\Users\xxxxxx\workspace/../junit-workspace -dev file:C:/Users/xxxxx/workspace/.metadata/.plugins/org.eclipse.pde.core/pde-junit/dev.properties -debug -consoleLog -os win32 -ws win32 -arch x86_64 -testLoaderClass org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader -loaderpluginname org.eclipse.jdt.junit4.runtime
!ENTRY org.eclipse.equinox.app 0 0 2014-05-03 01:04:20.992
!MESSAGE Product com.example.rcpmain.rcpmain could not be found.
!ENTRY org.eclipse.osgi 4 0 2014-05-03 01:04:21.994
!MESSAGE Application error
!STACK 1
org.eclipse.core.runtime.AssertionFailedException: null argument:Could not find IExtension for application: com.example.rcpmain.application
at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:85)
at org.eclipse.swtbot.eclipse.junit.headless.UITestApplication.getApplication(UITestApplication.java:78)
at org.eclipse.swtbot.eclipse.junit.headless.UITestApplication.start(UITestApplication.java:45)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
[Updated on: Sun, 04 May 2014 21:40] by Moderator
|
|
|
Re: SWTBot Headless/Commandline Execution Failed [message #1332997 is a reply to message #1329010] |
Sun, 04 May 2014 19:10   |
Eclipse User |
|
|
|
Instead of executing the ant script, I tried the following command line option.
java -Xms256M -Xmx768M -XX:MaxPermSize=512M -jar c:/Users/xxxx/Downloads/eclipse-standard-kepler-SR2-win32-x86_64/eclipse/plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar -application org.eclipse.swtbot.eclipse.junit.headless.swtbottestapplication -testApplication com.example.rcpmain -testPluginName com.example.rcpmain.swtbot.tests formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter -className com.example.rcpmain.swtbot.AllTests -os win32 -ws win32 -arch x86_64 -consoleLog -debug
The execution of the above command simply opens the eclipse IDE, not the actual tests.
Here is the log file I got.
Install location:
file:/c:/Users/xxxxx/Downloads/eclipse-standard-kepler-SR2-win32-x86_64/eclipse/
Configuration file:
file:/c:/Users/xxxxx/Downloads/eclipse-standard-kepler-SR2-win32-x86_64/eclipse/configuration/config.ini loaded
Configuration location:
file:/c:/Users/xxxxx/Downloads/eclipse-standard-kepler-SR2-win32-x86_64/eclipse/configuration/
Framework located:
file:/c:/Users/xxxxx/Downloads/eclipse-standard-kepler-SR2-win32-x86_64/eclipse/plugins/org.eclipse.osgi_3.9.1.v20140110-1610.jar
Framework classpath:
file:/c:/Users/xxxxx/Downloads/eclipse-standard-kepler-SR2-win32-x86_64/eclipse/plugins/org.eclipse.osgi_3.9.1.v20140110-1610.jar
Debug options:
file:/C:/Users/xxxxx/Downloads/eclipse-standard-kepler-SR2-win32-x86_64/eclipse/.options not found
Time to load bundles: 5
org.eclipse.m2e.logback.configuration: The org.eclipse.m2e.logback.configuration bundle was activated before the state location was initialized. Will retry after the state location is initialized.
Starting application: 1170
org.eclipse.m2e.logback.configuration: Logback config file: C:\Users\xxxxx\workspace\.metadata\.plugins\org.eclipse.m2e.logback.configuration\logback.1.4.1.20140328-1905.xml
org.eclipse.m2e.logback.configuration: Initializing logback
org.eclipse.m2e.logback.configuration: eclipse.consoleLog=true
!SESSION 2014-05-04 23:44:22.180 -----------------------------------------------
eclipse.buildId=4.3.2.M20140221-1700
java.version=1.7.0_40
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_GB
Framework arguments: -application org.eclipse.swtbot.eclipse.junit.headless.swtbottestapplication -testApplication com.example.rcpmain -testPluginName com.example.rcpmain.swtbot.tests formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter -className com.example.rcpmain.swtbot.AllTests
Command-line arguments: -application org.eclipse.swtbot.eclipse.junit.headless.swtbottestapplication -testApplication com.example.rcpmain -testPluginName com.example.rcpmain.swtbot.tests formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter -className com.example.rcpmain.swtbot.AllTests -os win32 -ws win32 -arch x86_64 -consoleLog -debug
!ENTRY org.eclipse.ui 4 4 2014-05-04 23:44:26.686
!MESSAGE Unable to find Action Set: org.eclipse.mylyn.context.ui.actionSet
!ENTRY org.eclipse.ui 4 4 2014-05-04 23:44:26.692
!MESSAGE Unable to find Action Set: org.eclipse.mylyn.doc.actionSet
!ENTRY org.eclipse.ui 4 4 2014-05-04 23:44:26.693
!MESSAGE Unable to find Action Set: org.eclipse.mylyn.tasks.ui.navigation
!ENTRY org.eclipse.ui 4 4 2014-05-04 23:44:26.695
!MESSAGE Unable to find Action Set: org.eclipse.wb.core.ui.actionset
Application Started: 5896
Testsuite: com.example.rcpmain.swtbot.AllTests
Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
Caused an ERROR
Class not found "com.example.rcpmain.swtbot.AllTests cannot be found by com.example.rcpmain.swtbot.tests_1.0.0.201405042318"
org.eclipse.swtbot.eclipse.junit.headless.EclipseTestRunner$TestFailedException: Class not found "com.example.rcpmain.swtbot.AllTests cannot be found by com.example.rcpmain.swtbot.tests_1.0.0.201405042318"
at org.eclipse.swtbot.eclipse.junit.headless.EclipseTestRunner.runFailed(EclipseTestRunner.java:284)
at org.eclipse.swtbot.eclipse.junit.headless.EclipseTestRunner.getTest(EclipseTestRunner.java:246)
at org.eclipse.swtbot.eclipse.junit.headless.EclipseTestRunner.<init>(EclipseTestRunner.java:222)
at org.eclipse.swtbot.eclipse.junit.headless.EclipseTestRunner.run(EclipseTestRunner.java:206)
at org.eclipse.swtbot.eclipse.junit.headless.UITestApplication.runTests(UITestApplication.java:116)
at org.eclipse.e4.ui.internal.workbench.swt.E4Testable$1.run(E4Testable.java:72)
at java.lang.Thread.run(Unknown Source)
!ENTRY org.eclipse.core.jobs 4 2 2014-05-04 23:44:31.304
!MESSAGE An internal error occurred during: "Initializing Java Tooling".
!STACK 0
java.lang.NullPointerException
at org.eclipse.m2e.jdt.internal.MavenClasspathContainerInitializer.getBuildPathManager(MavenClasspathContainerInitializer.java:87)
at org.eclipse.m2e.jdt.internal.MavenClasspathContainerInitializer.initialize(MavenClasspathContainerInitializer.java:48)
at org.eclipse.jdt.internal.core.JavaModelManager.initializeContainer(JavaModelManager.java:2867)
at org.eclipse.jdt.internal.core.JavaModelManager$11.run(JavaModelManager.java:2773)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2345)
at org.eclipse.jdt.internal.core.JavaModelManager.initializeAllContainers(JavaModelManager.java:2813)
at org.eclipse.jdt.internal.core.JavaModelManager.getClasspathContainer(JavaModelManager.java:1897)
at org.eclipse.jdt.core.JavaCore.initializeAfterLoad(JavaCore.java:3990)
at org.eclipse.jdt.internal.ui.InitializeAfterLoadJob$RealJob.run(InitializeAfterLoadJob.java:36)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Could any one help me please to identify the problem ?
[Updated on: Sun, 04 May 2014 21:41] by Moderator
|
|
|
|
|
Re: SWTBot Headless/Commandline Execution Failed [message #1334801 is a reply to message #1334012] |
Mon, 05 May 2014 15:12   |
Eclipse User |
|
|
|
Hi Mickael,
Thanks for the reply. I found that I was not using the incorrect test class name, and the error is resolved. Unfortunately, after I ran the following command line option, it only opens Eclipse IDE not the actual application.
Command line:
=============
java -Xms256M -Xmx768M -XX:MaxPermSize=512M -jar c:/XXXXX/eclipse/plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar -application org.eclipse.swtbot.eclipse.junit.headless.swtbottestapplication -testApplication com.example.rcpmain -data C:/XXXXX/workspace -testPluginName com.example.rcpmain.swtbot.tests formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,c:/XXXXX/reports/com.example.rcpmain.swtbot.tests.AllTests.xml formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter -className com.example.rcpmain.swtbot.tests.AllTests -os win32 -ws win32 -arch x86_64 -consoleLog -debug
The test I ran ( totally 2 tests) doesn't do anything great. When I ran the swtbot test via Eclipse IDE, I can't see the actual application gets launched.
Test File
=========
package com.example.rcpmain.swtbot.tests;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(SWTBotJunit4ClassRunner.class)
public class Tester {
private final SWTWorkbenchBot bot = new SWTWorkbenchBot();
@BeforeClass
public static void beforeTest() {
System.out.println("****Hello Test***");
}
@Test
public void test1() {
System.out.println("Test1 Run***");
}
@Test
public void test2() {
System.out.println("Test2 Run***");
}
}
Output Console Log
==================
Install location:
file:/c:/XXXXX/eclipse/
Configuration file:
file:/c:/XXXXX/eclipse/configuration/config.ini loaded
Configuration location:
file:/c:/XXXXX/eclipse/configuration/
Framework located:
file:/c:/XXXXX/eclipse/plugins/org.eclipse.osgi_3.9.1.v20140110-1610.jar
Framework classpath:
file:/c:/XXXXX/eclipse/plugins/org.eclipse.osgi_3.9.1.v20140110-1610.jar
Debug options:
file:/C:/XXXXX/eclipse/.options not found
Time to load bundles: 5
org.eclipse.m2e.logback.configuration: The org.eclipse.m2e.logback.configuration bundle was activated before the state location was initialized. Will retry after the state location is initialized.
Starting application: 1150
org.eclipse.m2e.logback.configuration: Logback config file: C:\XXXXX\workspace\.metadata\.plugins\org.eclipse.m2e.logback.configuration\logback.1.4.0.20130601-0317.xml
org.eclipse.m2e.logback.configuration: Initializing logback
org.eclipse.m2e.logback.configuration: eclipse.consoleLog=true
Application Started: 6280
Testsuite: com.example.rcpmain.swtbot.tests.AllTests
****Hello Test***
Test1 Run***
Test2 Run***
Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 0.106 sec
Testcase: test took 0.004 sec
Testcase: test2 took 0 sec
!SESSION 2014-05-05 19:37:34.633 -----------------------------------------------
eclipse.buildId=4.3.2.M20140221-1700
java.version=1.7.0_40
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_GB
Framework arguments: -application org.eclipse.swtbot.eclipse.junit.headless.swtbottestapplication -testApplication com.example.rcpmain -testPluginName com.example.rcpmain.swtbot.tests formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,c:/XXXXX/reports/com.example.rcpmain.swtbot.tests.AllTests.xml formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter -className com.example.rcpmain.swtbot.tests.AllTests
Command-line arguments: -application org.eclipse.swtbot.eclipse.junit.headless.swtbottestapplication -testApplication com.example.rcpmain -data C:/Ebenezer/workspace -testPluginName com.example.rcpmain.swtbot.tests formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,c:/XXXXX/reports/com.example.rcpmain.swtbot.tests.AllTests.xml formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter -className com.example.rcpmain.swtbot.tests.AllTests -os win32 -ws win32 -arch x86_64 -consoleLog -debug
!ENTRY org.eclipse.egit.ui 2 0 2014-05-05 19:37:42.282
!MESSAGE Warning: EGit couldn't detect the installation path "gitPrefix" of native Git. Hence EGit can't respect system level
Git settings which might be configured in ${gitPrefix}/etc/gitconfig under the native Git installation directory.
The most important of these settings is core.autocrlf. Git for Windows by default sets this parameter to true in
this system level configuration. The Git installation location can be configured on the
Team > Git > Configuration preference page's 'System Settings' tab.
This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.
!ENTRY org.eclipse.egit.ui 2 0 2014-05-05 19:37:42.283
!MESSAGE Warning: The environment variable HOME is not set. The following directory will be used to store the Git
user global configuration and to define the default location to store repositories: 'C:\Users\ebenezer.franklin'. If this is
not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and
EGit might behave differently since they see different configuration options.
This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.
!ENTRY org.eclipse.core.jobs 4 2 2014-05-05 20:08:42.044
!MESSAGE An internal error occurred during: "Initializing Java Tooling".
!STACK 0
java.lang.IllegalStateException: BundleContext is no longer valid
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.checkValid(BundleContextImpl.java:931)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.getServiceReference(BundleContextImpl.java:528)
at org.eclipse.pde.internal.core.PDECore.acquireService(PDECore.java:359)
at org.eclipse.pde.internal.core.PluginModelManager.initDefaultTargetPlatformDefinition(PluginModelManager.java:587)
at org.eclipse.pde.internal.core.PluginModelManager.initializeTable(PluginModelManager.java:560)
at org.eclipse.pde.internal.core.PluginModelManager.findModel(PluginModelManager.java:902)
at org.eclipse.pde.core.plugin.PluginRegistry.findModel(PluginRegistry.java:110)
at org.eclipse.pde.internal.core.RequiredPluginsInitializer.initialize(RequiredPluginsInitializer.java:27)
at org.eclipse.jdt.internal.core.JavaModelManager.initializeContainer(JavaModelManager.java:2867)
at org.eclipse.jdt.internal.core.JavaModelManager$11.run(JavaModelManager.java:2773)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2345)
at org.eclipse.jdt.internal.core.JavaModelManager.initializeAllContainers(JavaModelManager.java:2813)
at org.eclipse.jdt.internal.core.JavaModelManager.getClasspathContainer(JavaModelManager.java:1897)
at org.eclipse.jdt.core.JavaCore.initializeAfterLoad(JavaCore.java:3990)
at org.eclipse.jdt.internal.ui.InitializeAfterLoadJob$RealJob.run(InitializeAfterLoadJob.java:36)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Regards
Fred
[Updated on: Tue, 06 May 2014 05:00] by Moderator
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.09562 seconds