Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Failed to start test application with "Application Error" message
Failed to start test application with "Application Error" message [message #632082] Mon, 11 October 2010 13:50 Go to next message
Ravi  is currently offline Ravi Friend
Messages: 7
Registered: October 2010
Junior Member
Hi Ketan

I tried to execute a swtbot test using "headless" option on an exported Eclipse application. But, it fails to start the test application with "Application error" message. Following are the logs:

Install location:
file:/c:/Program Files/XXXX/XXXX/
Configuration file:
file:/c:/Program Files/XXXX/XXXX/configuration/config.ini loaded
Configuration location:
file:/c:/Program Files/XXXX/XXXX/configuration/
Framework located:
file:/c:/Program Files/XXXX/XXXX/plugins/org.eclipse.osgi_3.5.0.v20090520.jar
Framework classpath:
file:/c:/Program Files/XXXX/XXXX/plugins/org.eclipse.osgi_3.5.0.v20090520.jar
Debug options:
file:/C:/Documents and Settings/rsingal/Desktop/.options not found
Time to load bundles: 15
Starting application: 1110
!SESSION 2010-10-11 19:05:55.592 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.6.0_19
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Framework arguments: -application org.eclipse.swtbot.eclipse.junit4.headless.swtbottestapplica tion -testApplication com.lm.uc.app.application -product com.lm.uc.app.product formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJU nitResultFormatter,results.xml formatter=org.apache.tools.ant.taskdefs.optional.junit.Plain JUnitResultFormatter -testPluginName com.lm.uc.app.product.swtbottests -className MyFirstTestCase
Command-line arguments: -application org.eclipse.swtbot.eclipse.junit4.headless.swtbottestapplica tion -testApplication com.lm.uc.app.application -product com.lm.uc.app.product -data test-workspace formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJU nitResultFormatter,results.xml formatter=org.apache.tools.ant.taskdefs.optional.junit.Plain JUnitResultFormatter -testPluginName com.lm.uc.app.product.swtbottests -className MyFirstTestCase -os win32 -ws win32 -arch x86 -consoleLog -debug

!ENTRY org.eclipse.osgi 4 0 2010-10-11 19:05:56.749
!MESSAGE Application error
!STACK 1
org.eclipse.core.runtime.AssertionFailedException: null argument:
at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:85)
at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:73)
at org.eclipse.swtbot.eclipse.junit4.headless.UITestApplication .start(UITestApplication.java:47)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:194)
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(EclipseS tarter.java:368)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 559)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
at org.eclipse.equinox.launcher.Main.main(Main.java:1287)
at org.eclipse.core.launcher.Main.main(Main.java:34)

I do not have access to the source code of the test application. I copied the required plugin jar files in the ECLIPSE_HOME/plugins folder and then executed the following command from the Command Prompt:

java -Xms256M -Xmx512M -XX:MaxPermSize=512M -classpath "C:\Program Files\XXXX\XXXX\plugins\org.eclipse.equinox.launcher_1.0.200 .v20090520.jar " org.eclipse.core.launcher.Main -application org.eclipse.swtbot.eclipse.junit4.headless.swtbottestapplica tion -testApplication com.lm.uc.app.application -product com.lm.uc.app.product -data test-workspace formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJU nitResultFormatter,results.xml formatter=org.apache.tools.ant.taskdefs.optional.junit.Plain JUnitResultFormatter -testPluginName com.lm.uc.app.product.swtbottests -className MyFirstTestCase -os win32 -ws win32 -arch x86 -consoleLog -debug

but, it fails to start the application. Am I missing some required plugin or we have to make some changes in the test application itself?

[Updated on: Mon, 11 October 2010 13:51]

Report message to a moderator

Re: Failed to start test application [message #632124 is a reply to message #632082] Mon, 11 October 2010 15:45 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
Messages: 873
Registered: July 2009
Senior Member
Looking at the stacktrace indicates that the application corresponding
to -testApplication is not found. I've fixed the error messages to
provide more information on what went wrong instead of a stacktrace like
the one you just saw.

Please see http://wiki.eclipse.org/SWTBot/Troubleshooting if you're
unable to run eclipse with the following args

-application com.your.application.id -consoleLog -debug -os win32 -ws
win32 -arch x86

If you're unable to start the app with the above command line, means
that your application might be missing some dependencies, or that swtbot
may have broken some of your apps dependencies causing it to not startup...

--
Ketan
ketan.padegaonkar.name | eclipse.org/swtbot | @ketanpkr

On 10/11/10 6:50 AM, Ravi wrote:
> Hi Ketan
>
> I tried to execute a swtbot test using "headless" option on an exported
> Eclipse application. But, it fails to start the test application with
> "Application error" message. Following are the logs:
>
> Install location:
> file:/c:/Program Files/XXXX/XXXX/
> Configuration file:
> file:/c:/Program Files/XXXX/XXXX/configuration/config.ini loaded
> Configuration location:
> file:/c:/Program Files/XXXX/XXXX/configuration/
> Framework located:
> file:/c:/Program
> Files/XXXX/XXXX/plugins/org.eclipse.osgi_3.5.0.v20090520.jar
> Framework classpath:
> file:/c:/Program
> Files/XXXX/XXXX/plugins/org.eclipse.osgi_3.5.0.v20090520.jar
> Debug options:
> file:/C:/Documents and Settings/rsingal/Desktop/.options not found
> Time to load bundles: 15
> Starting application: 1110
> !SESSION 2010-10-11 19:05:55.592
> -----------------------------------------------
> eclipse.buildId=unknown
> java.version=1.6.0_19
> java.vendor=Sun Microsystems Inc.
> BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
> Framework arguments: -application
> org.eclipse.swtbot.eclipse.junit4.headless.swtbottestapplica tion
> -testApplication com.lm.uc.app.application -product
> com.lm.uc.app.product
> formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJU
> nitResultFormatter,results.xml
> formatter=org.apache.tools.ant.taskdefs.optional.junit.Plain
> JUnitResultFormatter -testPluginName com.lm.uc.app.product.swtbottests
> -className MyFirstTestCase
> Command-line arguments: -application
> org.eclipse.swtbot.eclipse.junit4.headless.swtbottestapplica tion
> -testApplication com.lm.uc.app.application -product
> com.lm.uc.app.product -data test-workspace
> formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJU
> nitResultFormatter,results.xml
> formatter=org.apache.tools.ant.taskdefs.optional.junit.Plain
> JUnitResultFormatter -testPluginName com.lm.uc.app.product.swtbottests
> -className MyFirstTestCase -os win32 -ws win32 -arch x86 -consoleLog -debug
>
> !ENTRY org.eclipse.osgi 4 0 2010-10-11 19:05:56.749
> !MESSAGE Application error
> !STACK 1
> org.eclipse.core.runtime.AssertionFailedException: null argument:
> at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:85)
> at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:73)
> at org.eclipse.swtbot.eclipse.junit4.headless.UITestApplication
> .start(UITestApplication.java:47)
> at org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips
> eAppHandle.java:194)
> 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(EclipseS
> tarter.java:368)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS
> tarter.java:179)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 559)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1287)
> at org.eclipse.core.launcher.Main.main(Main.java:34)
>
> I do not have access to the source code of the test application. I
> copied the required plugin jar files in the ECLIPSE_HOME/plugins folder
> and then executed the following command from the Command Prompt:
>
> java -Xms256M -Xmx512M -XX:MaxPermSize=512M -classpath "C:\Program
> Files\XXXX\XXXX\plugins\org.eclipse.equinox.launcher_1.0.200
> .v20090520.jar " org.eclipse.core.launcher.Main -application
> org.eclipse.swtbot.eclipse.junit4.headless.swtbottestapplica tion
> -testApplication com.lm.uc.app.application -product
> com.lm.uc.app.product -data test-workspace
> formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJU
> nitResultFormatter,results.xml
> formatter=org.apache.tools.ant.taskdefs.optional.junit.Plain
> JUnitResultFormatter -testPluginName com.lm.uc.app.product.swtbottests
> -className MyFirstTestCase -os win32 -ws win32 -arch x86 -consoleLog -debug
> but, it fails to start the application. Am I missing some required
> plugin or we have to make some changes in the test application itself?
>
Re: Failed to start test application [message #632196 is a reply to message #632124] Tue, 12 October 2010 05:32 Go to previous messageGo to next message
Ravi  is currently offline Ravi Friend
Messages: 7
Registered: October 2010
Junior Member
Hi Ketan

Thanks for the reply.

As suggested by you, it tried to run the eclipse with the following arguments:

-application com.lm.uc.app.application -consoleLog -debug -os win32 -ws win32 -arch x86

and it was able to launch the application!

and also, the osgi console is able to find my test application:

osgi> apps
org.eclipse.equinox.p2.artifact.repository.mirrorApplication [launchable]
org.eclipse.help.base.helpApplication [launchable]
org.eclipse.equinox.p2.metadata.repository.mirrorApplication [launchable]
org.eclipse.help.base.indexTool [launchable]
org.eclipse.swtbot.eclipse.junit4.headless.swtbottestapplica tion [not launchable]
com.lm.uc.app.application [launchable]
org.eclipse.help.base.infocenterApplication [launchable]
org.eclipse.equinox.app.error [not launchable]
org.eclipse.ant.core.antRunner [launchable]
org.eclipse.swtbot.eclipse.core.swtbottestapplication [not launchable]


but, still it does not lauch my test application.
Re: Failed to start test application [message #632567 is a reply to message #632124] Wed, 13 October 2010 13:22 Go to previous messageGo to next message
Ravi  is currently offline Ravi Friend
Messages: 7
Registered: October 2010
Junior Member
Hi Ketan

I put some debug lines in the getApplication method in UITestApplication.java to find out the exact reason for not launching the test application. It fails on the condition "runnable instanceof IApplication" and returns null. Following is the modified getApplication method:

private Object getApplication(String[] args) throws CoreException {
// Find the name of the application as specified by the PDE JUnit launcher.
// If no application is specified, the 3.0 default workbench application
// is returned.
String applicationToRun = getApplicationToRun(args);
IExtension extension = Platform.getExtensionRegistry().getExtension(Platform.PI_RUN TIME, Platform.PT_APPLICATIONS,
applicationToRun);

Assert.isNotNull(extension, "Could not find IExtension for application: " + applicationToRun);

// If the extension does not have the correct grammar, return null.
// Otherwise, return the application object.
IConfigurationElement[] elements = extension.getConfigurationElements();
System.out.println("configuration length:" + elements.length);
if (elements.length > 0) {
System.out.println("name of the configuration: " + elements[0].getName());
IConfigurationElement[] runs = elements[0].getChildren("run"); //$NON-NLS-1$
System.out.println("runs length:" + runs.length);
if (runs.length > 0) {
System.out.println("name of the run: " + runs[0].getName());
System.out.println("class name: " + runs[0].getAttribute("class"));
Object runnable = runs[0].createExecutableExtension("class"); //$NON-NLS-1$
System.out.println("Object Class Name:" + runnable.getClass());
if (runnable instanceof IApplication){
System.out.println("returning runnable...");
return runnable;
} else {
System.out.println ("runnable is not an instance of IApplication");
//return runnable;
}
}
}
System.out.println("returning null...");
return null;
}


and it gives the following output:

configuration length:1
name of the configuration: application
runs length:1
name of the run: run
class name: com.lm.uc.app.Application
Object Class Name:class com.lm.uc.app.Application
runnable is not an instance of IApplication
returning null...
Re: Failed to start test application [message #632597 is a reply to message #632567] Wed, 13 October 2010 14:28 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
Messages: 873
Registered: July 2009
Senior Member
Awesome, I think you nailed it :)

The application class uses the legacy IPlatformRunnable interface
(http://goo.gl/inAq) instead of the new IApplication
(http://goo.gl/qXx3) interface.

SWTBot does not support the legacy interface in the interest of keeping
the codebase simple and easy to manage.

See the legacy UITestApplication implementation(http://goo.gl/An90) for
details on how to handle legacy application. I'd suggest creating a
custom 'org.yourcompany.swtbot.eclipse.junit4.headless' fragment with
the legacy UITestApplication instead of swtbot's UITestApplication.
Replace the runTests method in it with the one from swtbot's launcher
for your tests to work correctly.

Alternatively:

Change the UITestApplication so that all instanceof and casting
operations in the start() and getApplication() also handle
IPlatformRunnable in addition to(or instead of) IApplication.

--
Ketan
ketan.padegaonkar.name | eclipse.org/swtbot | @ketanpkr

On 10/13/10 6:22 AM, Ravi wrote:
> Hi Ketan
>
> I put some debug lines in the getApplication method in
> UITestApplication.java to find out the exact reason for not launching
> the test application. It fails on the condition "runnable instanceof
> IApplication" and returns null. Following is the modified getApplication
> method:
>
> private Object getApplication(String[] args) throws CoreException {
> // Find the name of the application as specified by the PDE JUnit launcher.
> // If no application is specified, the 3.0 default workbench application
> // is returned.
> String applicationToRun = getApplicationToRun(args);
> IExtension extension =
> Platform.getExtensionRegistry().getExtension(Platform.PI_RUN TIME,
> Platform.PT_APPLICATIONS,
> applicationToRun);
>
> Assert.isNotNull(extension, "Could not find IExtension for application:
> " + applicationToRun);
>
> // If the extension does not have the correct grammar, return null.
> // Otherwise, return the application object.
> IConfigurationElement[] elements = extension.getConfigurationElements();
> System.out.println("configuration length:" + elements.length);
> if (elements.length > 0) {
> System.out.println("name of the configuration: " + elements[0].getName());
> IConfigurationElement[] runs = elements[0].getChildren("run");
> //$NON-NLS-1$
> System.out.println("runs length:" + runs.length);
> if (runs.length > 0) {
> System.out.println("name of the run: " + runs[0].getName());
> System.out.println("class name: " + runs[0].getAttribute("class"));
> Object runnable = runs[0].createExecutableExtension("class"); //$NON-NLS-1$
> System.out.println("Object Class Name:" + runnable.getClass());
> if (runnable instanceof IApplication){
> System.out.println("returning runnable...");
> return runnable;
> } else {
> System.out.println ("runnable is not an instance of IApplication");
> //return runnable;
> }
> }
> }
> System.out.println("returning null...");
> return null;
> }
>
>
> and it gives the following output:
>
> configuration length:1
> name of the configuration: application
> runs length:1
> name of the run: run
> class name: com.lm.uc.app.Application
> Object Class Name:class com.lm.uc.app.Application
> runnable is not an instance of IApplication
> returning null...
Re: Failed to start test application [message #633300 is a reply to message #632597] Sat, 16 October 2010 06:46 Go to previous message
Ravi  is currently offline Ravi Friend
Messages: 7
Registered: October 2010
Junior Member
Thanks for the reply. I have changed the UITestApplication to take care of the IPlatformRunnable interface. I am now able to launch the test application successfully.
Previous Topic:Problems running tutorial from command line on Linux
Next Topic:java.lang.NoClassDefFoundError: junit/framework/TestListener
Goto Forum:
  


Current Time: Fri Apr 19 22:07:37 GMT 2024

Powered by FUDForum. Page generated in 0.03118 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top