Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » SWTBot - Ant issue
SWTBot - Ant issue [message #524602] Thu, 01 April 2010 14:57 Go to next message
Urtzi Odriozola is currently offline Urtzi Odriozola
Messages: 27
Registered: March 2010
Junior Member
Hi,

I'm trying to run my swtbot example using ant. But when I execute the modified script taken from http://github.com/ketan/swtbot/blob/master/org.eclipse.swtbo t.releng/test-sandbox/org.eclipse.swtbot.eclipse.finder.test .xml
the cmd shows me the error below:
init:

suite:

init:

swtbot-test:

java-test:
     [echo] ======================================
     [echo] Running swtbot junit tests in testCases.CompleteExample
     [echo] Command line args are     -application org.eclipse.swtbot.eclipse.ju
nit4.headless.swtbottestapplication    -product org.eclipse.platform.ide
-data workspace    formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUn
itResultFormatter,G:\Eclipse_3.5/testCases.CompleteExample.xml formatter=org.apa
che.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter    -testPluginNa
me com.eclipse.swtbot.completeExample    -className testCases.CompleteExample
 -os win32    -ws win32    -arch x86    -consoleLog    -debug
     [echo] JVM args are  -Xms128M -Xmx368M -XX:MaxPermSize=256M
     [echo] JUnit Result File: G:\Eclipse_3.5\results/testCases.CompleteExample.
xml.
     [echo] Console output File: G:\Eclipse_3.5\results/testCases.CompleteExampl
e.txt.
     [echo] ======================================
     [java] Exception in thread "WorkbenchTestable" java.lang.NoClassDefFoundErr
or: junit/framework/TestListener
     [java]     at java.lang.ClassLoader.defineClass1(Native Method)
     [java]     at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
     [java]     at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defi
neClass(DefaultClassLoader.java:183)
     [java]     at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineCl
ass(ClasspathManager.java:576)
     [java]     at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClas
sImpl(ClasspathManager.java:546)
     [java]     at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLoca
lClassImpl(ClasspathManager.java:477)
     [java]     at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLoca
lClass_LockClassLoader(ClasspathManager.java:465)
     [java]     at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLoca
lClass(ClasspathManager.java:445)
     [java]     at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.find
LocalClass(DefaultClassLoader.java:211)
     [java]     at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(
BundleLoader.java:381)
     [java]     at org.eclipse.osgi.internal.loader.BundleLoader.findClassIntern
al(BundleLoader.java:457)
     [java]     at org.eclipse.osgi.internal.loader.BundleLoader.findClass(Bundl
eLoader.java:410)
     [java]     at org.eclipse.osgi.internal.loader.BundleLoader.findClass(Bundl
eLoader.java:398)
     [java]     at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.load
Class(DefaultClassLoader.java:105)
     [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
     [java]     at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)

     [java]     at java.lang.ClassLoader.defineClass1(Native Method)
     [java]     at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
     [java]     at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defi
neClass(DefaultClassLoader.java:183)
     [java]     at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineCl
ass(ClasspathManager.java:576)
     [java]     at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClas
sImpl(ClasspathManager.java:546)
     [java]     at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLoca
lClassImpl(ClasspathManager.java:477)
     [java]     at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLoca
lClass_LockClassLoader(ClasspathManager.java:465)
     [java]     at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLoca
lClass(ClasspathManager.java:445)
     [java]     at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.find
LocalClass(DefaultClassLoader.java:211)
     [java]     at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(
BundleLoader.java:381)
     [java]     at org.eclipse.osgi.internal.loader.SingleSourcePackage.loadClas
s(SingleSourcePackage.java:33)
     [java]     at org.eclipse.osgi.internal.loader.BundleLoader.findClassIntern
al(BundleLoader.java:445)
     [java]     at org.eclipse.osgi.internal.loader.BundleLoader.findClass(Bundl
eLoader.java:410)
     [java]     at org.eclipse.osgi.internal.loader.BundleLoader.findClass(Bundl
eLoader.java:398)
     [java]     at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.load
Class(DefaultClassLoader.java:105)
     [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
     [java]     at org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner.
createFormatter(EclipseTestRunner.java:455)
     [java]     at org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner.
createAndStoreFormatter(EclipseTestRunner.java:437)
     [java]     at org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner.
run(EclipseTestRunner.java:179)
     [java]     at org.eclipse.swtbot.eclipse.junit4.headless.UITestApplication.
runTests(UITestApplication.java:115)
     [java]     at org.eclipse.ui.internal.testing.WorkbenchTestable$1.run(Workb
enchTestable.java:71)
     [java]     at java.lang.Thread.run(Thread.java:619)
     [echo] ======================================
     [echo] If you see errors above please see the file G:\Eclipse_3.5\results/t
estCases.CompleteExample.txt for more information.
     [echo] Errors are generally caused by missing or incorrect dependencies.
     [echo] ======================================

collect-results:
    [style] Warning: the task name <style> is deprecated. Use <xslt> instead.
    [style] Transforming into G:\Eclipse_3.5\results

cleanup:

run:

collect:
[junitreport] the file G:\Eclipse_3.5\${plugin-name}.xml is not a valid testsuit
e XML document
[junitreport] the file G:\Eclipse_3.5\com.eclipse.swtbot.completeExample.xml is not a valid t
estsuite XML document

BUILD SUCCESSFUL
Total time: 49 seconds


I've followed the http://download.eclipse.org/technology/swtbot/docs/videos/be ginners/SWTBotHeadlessTestingForNovices/ video tutorial and I think that I already added all needed dependecies... But I'm still blocked with that error.

Can someone give me a hint?? If you need some more information, please, let me know.

Thanks for help!!
Re: SWTBot - Ant issue [message #524613 is a reply to message #524602] Thu, 01 April 2010 15:20 Go to previous messageGo to next message
Pascal G is currently offline Pascal G
Messages: 157
Registered: July 2009
Senior Member
Urtzi Odriozola wrote:
> [echo] ======================================
> [java] Exception in thread "WorkbenchTestable"
> java.lang.NoClassDefFoundErr
> or: junit/framework/TestListener
> [java] at java.lang.ClassLoader.defineClass1(Native Method)
> [java] at java.lang.ClassLoader.defineClass(ClassLoader.java:620)

Hmmm, if I remember well, this one is caused either by JUnit missing
from your target platform or you have both the JUnit3 and JUnit4
fragments in your target platform. However, NoClassDefFoundError points
more towards missing JUnit in your target platform. If it is in there,
make sure it is loaded by the OSGi runtime by running eclipse with the
-console option, type ss in the provided console and look for the junit
plugin.


> collect:
> [junitreport] the file G:\Eclipse_3.5\${plugin-name}.xml is not a valid

Looks like you are missing an ant property definition here...

Hope this helps.
--
Pascal Gélinas | Software Developer
*Nu Echo Inc.*
http://www.nuecho.com/ | http://blog.nuecho.com/

*Because performance matters.*
Re: SWTBot - Ant issue [message #526216 is a reply to message #524602] Fri, 09 April 2010 09:23 Go to previous messageGo to next message
Urtzi Odriozola is currently offline Urtzi Odriozola
Messages: 27
Registered: March 2010
Junior Member
Thank you for the response!!

I'm trying to follow your advices but still doesn't work... I know that the jUnit plugin it's in the target and I'm sure that I've got only a jUnit4 dependency. So the problem would be that I'm not loading with the OSGi runtime.

I don't understand when you say that I should run eclipse with the -console option...

I'm just running an eclipse application from my workbench, where in the new eclipse instance, I've got all the necessary stuff (swtbot tests, build.xml...). And then trying to run a build.xml ant file from the command line.

I'm doing like that, just because the tests are generated. So, in the second instance of eclipse I've got all the mechanism for that purpose.

So, can you explain me with more detail how can I load with OSGi runtime, please?

Thank you for your help!!
Regards,
Re: SWTBot - Ant issue [message #526296 is a reply to message #526216] Fri, 09 April 2010 14:11 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan Padegaonkar
Messages: 873
Registered: July 2009
Senior Member
This might help. It's a step by step tutorial on how you could get
headless tests running.

http://richardadams606blog.blogspot.com/2010/04/headless-swt bot-testing-for-eclipse-rcp.html

– Ketan

On 4/9/10 2:23 AM, Urtzi Odriozola wrote:
> Thank you for the response!!
>
> I'm trying to follow your advices but still doesn't work... I know that
> the jUnit plugin it's in the target and I'm sure that I've got only a
> jUnit4 dependency. So the problem would be that I'm not loading with the
> OSGi runtime.
>
> I don't understand when you say that I should run eclipse with the
> -console option...
>
> I'm just running an eclipse application from my workbench, where in the
> new eclipse instance, I've got all the necessary stuff (swtbot tests,
> build.xml...). And then trying to run a build.xml ant file from the
> command line.
>
> I'm doing like that, just because the tests are generated. So, in the
> second instance of eclipse I've got all the mechanism for that purpose.
>
> So, can you explain me with more detail how can I load with OSGi
> runtime, please?
>
> Thank you for your help!!
> Regards,
Re: SWTBot - Ant issue [message #526324 is a reply to message #524602] Fri, 09 April 2010 16:31 Go to previous messageGo to next message
Urtzi Odriozola is currently offline Urtzi Odriozola
Messages: 27
Registered: March 2010
Junior Member
Thank you very much!!!

I'll try it and post my results soon!!
Re: SWTBot - Ant issue [message #526373 is a reply to message #526324] Fri, 09 April 2010 22:14 Go to previous messageGo to next message
Richard Adams is currently offline Richard Adams
Messages: 77
Registered: July 2009
Location: Edinburgh
Member
Not sure if this is an issue as you are launching the IDE rather than an RCP, but make sure you have the PDE feature included in your application under test as well, as the SWTBot tests depend on this.
Richard


Re: SWTBot - Ant issue [message #526682 is a reply to message #524602] Mon, 12 April 2010 15:18 Go to previous messageGo to next message
Urtzi Odriozola is currently offline Urtzi Odriozola
Messages: 27
Registered: March 2010
Junior Member
First of all, thank you for all your responses. But I think that the given solution doesn't work...

My goal is just to test an eclipse IDE which contains my own plugins already installed. But I wanna automatize those test so, I think that ant would be a good idea for that.

If I run the SWTBot test from the IDE with a proper run configuration, it works perfectly, but I wanna run my tests from a cmd using ant scripts.

Please, someone has another idea?
Re: SWTBot - Ant issue [message #526692 is a reply to message #526682] Mon, 12 April 2010 15:36 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan Padegaonkar
Messages: 873
Registered: July 2009
Senior Member
Richard's blog post is the longer version of it all.

If you've already got your plugins and test plugins installed in your
target then you're way ahead :)

You can skip most of Richard's blog until step 4.e that describes an ant
build that runs the tests.

– Ketan

On 4/12/10 8:18 AM, Urtzi Odriozola wrote:
> First of all, thank you for all your responses. But I think that the
> given solution doesn't work...
>
> My goal is just to test an eclipse IDE which contains my own plugins
> already installed. But I wanna automatize those test so, I think that
> ant would be a good idea for that.
>
> If I run the SWTBot test from the IDE with a proper run configuration,
> it works perfectly, but I wanna run my tests from a cmd using ant scripts.
>
> Please, someone has another idea?
Re: SWTBot - Ant issue [message #528871 is a reply to message #524602] Thu, 22 April 2010 09:04 Go to previous message
Urtzi Odriozola is currently offline Urtzi Odriozola
Messages: 27
Registered: March 2010
Junior Member
I solved the issue!! At the end, I installed a new target with the last swtbot update, and everything goes perfect!!

I think that I had a mess with the bundles. But now with the new installation features, everything is very easy.

Thank you very much!!!
Previous Topic:SWTBot typeText is getting a java.lang.ExceptionInitializerError
Next Topic:Splashscreen not shown
Goto Forum:
  


Current Time: Thu Oct 23 00:40:25 GMT 2014

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

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