Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » More help with RCP app/SWTBot/ANT
More help with RCP app/SWTBot/ANT [message #35466] Fri, 15 May 2009 21:40 Go to next message
Jack Markarian is currently offline Jack MarkarianFriend
Messages: 3
Registered: July 2009
Junior Member
Hi All,
I'm new to this portal but have been using SWTBot for about 2 months
already with great success. However, the issue with ANT and RCP is still
a major pain point. I have been trying for the past 2 weeks to run my
swtbot tests against my RCP app from command line using ANT. This topic
has been discussed several times on this portal, and yet I still can't get
it to work. I hope I can get some help from all of you as this is very
important for our build verification scenerio. The newest thread on this
topic was from 3/17 titled "Automating the launch of SWTBot tests with
Ant" which is what I used to set things up. I'll explain my setup, paste
my build.xml, and show the results of my test run below, but before I get
into those details, I'll just give a high level explanation of what is
happening. I run "ant test", the PDE listener target gets an error during
startup (I'll worry about this later), then when the execute target is
started, I get the following error:

!ENTRY org.eclipse.ui 4 4 2009-05-15 11:59:17.821
!MESSAGE Referenced part does not exist yet: org.eclipse.ui.views.TaskList.
Application Started: 7123

But even though I get this error, the eclipse IDE IS launched, then a
minute later closes down (without having ran my test).


Now for the details:

Setup:
Download eclipse3.4-rcp
Create a plugin that has 1 test case in it that does
bot.view("Welcome").close();
This test case is running against the product: org.eclipse.sdk.ide
...
in my plugins dir, I have the SWTBot plugins (which I got using the
eclipse software updates)
I have my test plugin (that I exported from the workspace to the file
system and copied to plugins dir)
I have the 2 plugins that I took from the headless swtbot feature
(explained in SWTBOT wiki).. org.eclipse.swtbot.ant.optional.junit4 and
org.eclipse.swtbot.eclipse.junit4.headless
in plugins, I created a dir called lib and in it i put pde.test.utils.jar
(as explained in an older thread about how to launch rcp from ant by Hans
Schwaebli)

////////////////////////////////////

My build.xml file is pasted below:
(The main differences between Marc's build.xml and this one is that I am
using the JUnit4 runner, instead of -testApplication third.party.app I am
using -product org.eclipse.sdk.ide, and for the classpath, I don't do
**/*.jar in the eclipse/plugins dir (becuase windows gives an error when
the classpath is so big.. instead I just use the org.equinox launcher).


<project name="thirdparty-test" basedir=".">

<property name="test.workspace"
location="C:\swtbotantworkspace\workspace/../junit-workspace "/>
<property name="testcase" location="demotest"/>
<property name="testplugin" location="testProject"/>
<property name="build.home"
location="C:\eclipse-rcp-ganymede-SR2-win32\eclipse"/>
<property name="build.plugins" location="${build.home}/plugins"/>
<property name="java.home" location="C:\Program
Files\Java\jdk1.6.0_07"/>
<property name="ant.home"
location="C:\eclipse-rcp-ganymede-SR2-win32\eclipse\plugins "/>


<target name="test">
<parallel>
<daemons>
<antcall target="listen" />
</daemons>
<sequential>
<sleep seconds="10" />
<!-- Give the listener a few seconds to startup -->
<antcall target="execute" />
</sequential>
</parallel>
</target>
<target name="execute">
<echo>Debut target execute</echo>
<!--echo>${test.workspace}</echo-->
<!--delete dir="${test.workspace}" />
<mkdir dir="${test.workspace}" /-->
<!-- -classpath
/plugins/org.eclipse.equinox.launcher_1.0.101.R34x_v20080819 .jar
org.eclipse.core.launcher.Main equinox" dir="${build.home}"-->
<java classname="org.eclipse.core.launcher.Main" fork="true"
output="reports/demotest.txt" error="reports/demotest.err.txt">

<!--append="true"-->

<!--arg line="-Xms128M -Xmx368M -XX:MaxPermSize=256M" /-->
<arg line="-os win32" />
<arg line="-ws win32" />
<arg line="-arch x86" />
<arg line="-nl en_US" />
<arg line="-application" />
<arg line="org.eclipse.swtbot.eclipse.core.swtbottestapplication " />
<arg line="-classNames" />
<arg line="demotest" />
<arg line="-testpluginname" />
<arg line="testProject" />
<arg line="-version" />
<arg line="3" />
<arg line="-testLoaderClass" />
<arg line="org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader " />
<arg line="-loaderpluginname" />
<arg line="org.eclipse.jdt.junit4.runtime" />
<arg line="-product" />
<arg line="org.eclipse.sdk.ide" />
<arg line="-port" />
<arg line="2625" />
<arg line="-pdelaunch" />
<arg line="-data" />
<arg line="C:\swtbotcmdline\workspace/../junit-workspace" />
<arg line="-configuration
file:C:/swtbotcmdline/.metadata/.plugins/org.eclipse.pde.cor e/pde-junit/ "
/>
<arg line="-dev
file:C:/swtbotcmdline/.metadata/.plugins/org.eclipse.pde.cor e/pde-junit/dev.properties "
/>
<arg line="-debug" />
<arg line="-consolelog" />
<classpath>
<fileset dir="C:\eclipse-rcp-ganymede-SR2-win32\eclipse\plugins">
<include name="org.eclipse.equinox.launcher_*.jar" />
</fileset>
</classpath>
</java>
</target>
<!---->


<target name="listen">
<echo>Debut target listen</echo>
<java classname="pde.test.utils.PDETestResultsCollector">
<arg line="demotest 2625" />
<classpath>
<fileset dir="C:\eclipse-rcp-ganymede-SR2-win32\eclipse\plugins\lib" >
<include name="**/*.jar" />
</fileset>
<!--fileset dir="lib"-->
<!--fileset dir="C:\eclipse_auto\pde.test.utils\target"-->
<!--include name="**/*.jar" /-->
<!--/fileset-->
<fileset dir="${java.home}/lib">
<include name="**/*.jar" />
</fileset>
<fileset dir="C:\eclipse-rcp-ganymede-SR2-win32\eclipse\plugins">
<include name="org.eclipse.equinox.launcher_*.jar" />
</fileset>
</classpath>
</java>
</target>

</project>




/////////////////////////////
Output from running the ANT
/////////////////////////////

On the demotests.txt file that was created in the plugins/reports dir, the
output is

Configuration location:

file:/C:/swtbotcmdline/.metadata/.plugins/org.eclipse.pde.co re/pde-junit/
Configuration file:

file:/C:/swtbotcmdline/.metadata/.plugins/org.eclipse.pde.co re/pde-junit/config.ini
loaded
Install location:
file:/C:/eclipse-rcp-ganymede-SR2-win32/eclipse/
Framework located:

file:/C:/eclipse-rcp-ganymede-SR2-win32/eclipse/plugins/org. eclipse.osgi_3.4.3.R34x_v20081215-1030.jar
Framework classpath:

file:/C:/eclipse-rcp-ganymede-SR2-win32/eclipse/plugins/org. eclipse.osgi_3.4.3.R34x_v20081215-1030.jar
Debug options:
file:/C:/eclipse-rcp-ganymede-SR2-win32/eclipse/plugins/.opt ions not
found
Time to load bundles: 15
Starting application: 2026
!SESSION 2009-05-15 11:59:13.597
-----------------------------------------------
eclipse.buildId=M20090211-1700
java.version=1.6.0_07
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Framework arguments: -application
org.eclipse.swtbot.eclipse.core.swtbottestapplication -classNames demotest
-testpluginname testProject -version 3 -testLoaderClass
org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader -loaderpluginname
org.eclipse.jdt.junit4.runtime -product org.eclipse.sdk.ide -port 2625
-pdelaunch
Command-line arguments: -os win32 -ws win32 -arch x86 -application
org.eclipse.swtbot.eclipse.core.swtbottestapplication -classNames demotest
-testpluginname testProject -version 3 -testLoaderClass
org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader -loaderpluginname
org.eclipse.jdt.junit4.runtime -product org.eclipse.sdk.ide -port 2625
-pdelaunch -data C:\swtbotcmdline\workspace/../junit-workspace -dev
file:C:/swtbotcmdline/.metadata/.plugins/org.eclipse.pde.cor e/pde-junit/dev.properties
-debug -consolelog

!ENTRY org.eclipse.ui 4 4 2009-05-15 11:59:17.821
!MESSAGE Referenced part does not exist yet: org.eclipse.ui.views.TaskList.
Application Started: 7123





In the demotest.err.txt dir, the output is related to PDE listen target,
so I dont care too much:

Could not connect to: : 2625
java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.ja va:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:519)
at java.net.Socket.connect(Socket.java:469)
at java.net.Socket.<init>(Socket.java:366)
at java.net.Socket.<init>(Socket.java:180)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.conne ct(RemoteTestRunner.java:560)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:377)
at
org.eclipse.swtbot.eclipse.core.RemotePluginTestRunner.main( RemotePluginTestRunner.java:64)
at
org.eclipse.swtbot.eclipse.core.UITestApplication.runTests(U ITestApplication.java:123)
at
org.eclipse.ui.internal.testing.WorkbenchTestable$1.run(Work benchTestable.java:68)
at java.lang.Thread.run(Thread.java:619)





And on the console, the output is:


C:\eclipse-rcp-ganymede-SR2-win32\eclipse\plugins>ant test
Buildfile: build.xml

test:

listen:
[echo] Debut target listen
[java] java.lang.NoClassDefFoundError:
org/eclipse/jdt/internal/junit/model/ITestRunListener2
[java] at java.lang.ClassLoader.defineClass1(Native Method)
[java] at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
[java] at
org.apache.tools.ant.AntClassLoader.defineClassFromData(AntC lassLoader.java:1130)
[java] at
org.apache.tools.ant.AntClassLoader.getClassFromStream(AntCl assLoader.java:1307)
[java] at
org.apache.tools.ant.AntClassLoader.findClassInComponents(An tClassLoader.java:1371)
[java] at
org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader .java:1324)
[java] at
org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader .java:1078)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
[java] at
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319 )
[java] at
pde.test.utils.PDETestResultsCollector.run(PDETestResultsCol lector.java:16)
[java] at
pde.test.utils.PDETestResultsCollector.main(PDETestResultsCo llector.java:31)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
[java] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
[java] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:597)
[java] at
org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.ja va:217)
[java] at
org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJav a.java:152)
[java] at org.apache.tools.ant.taskdefs.Java.run(Java.java:747)
[java] at
org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:201 )
[java] at
org.apache.tools.ant.taskdefs.Java.execute(Java.java:104)
[java] at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.j ava:288)
[java] at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown
Source)
[java] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:597)
[java] at
org.apache.tools.ant.dispatch.DispatchUtils.execute(Dispatch Utils.java:105)
[java] at org.apache.tools.ant.Task.perform(Task.java:348)
[java] at org.apache.tools.ant.Target.execute(Target.java:357)
[java] at
org.apache.tools.ant.Target.performTasks(Target.java:385)
[java] at
org.apache.tools.ant.Project.executeSortedTargets(Project.ja va:1329)
[java] at
org.apache.tools.ant.helper.SingleCheckExecutor.executeTarge ts(SingleCheckExecutor.java:38)
[java] at
org.apache.tools.ant.Project.executeTargets(Project.java:118 1)
[java] at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
[java] at
org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget. java:105)
[java] at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.j ava:288)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
[java] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
[java] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:597)
[java] at
org.apache.tools.ant.dispatch.DispatchUtils.execute(Dispatch Utils.java:105)
[java] at org.apache.tools.ant.Task.perform(Task.java:348)
[java] at
org.apache.tools.ant.taskdefs.Parallel$TaskRunnable.run(Para llel.java:428)
[java] at java.lang.Thread.run(Thread.java:619)
[java] Caused by: java.lang.ClassNotFoundException:
org.eclipse.jdt.internal.junit.model.ITestRunListener2
[java] at
org.apache.tools.ant.AntClassLoader.findClassInComponents(An tClassLoader.java:1383)
[java] at
org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader .java:1324)
[java] at
org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader .java:1078)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
[java] at
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319 )
[java] ... 42 more

execute:
[echo] Debut target execute

BUILD SUCCESSFUL
Total time: 1 minute 14 seconds
C:\eclipse-rcp-ganymede-SR2-win32\eclipse\plugins>





On a final note, there was an older post by Hans Schwaebli where he had a
bug fix and posted a build.xml file there. Here is a link
http://swtbot.org/bugzilla/show_bug.cgi?id=76 I also tried to setup my
test run using this setup, but got the same error and same behavior..
!ENTRY org.eclipse.ui 4 4 2009-05-15 11:59:17.821
!MESSAGE Referenced part does not exist yet: org.eclipse.ui.views.TaskList.
Application Started: 7123

Except, when I used Han's build file, I didn't get any errors from the
listen target while launching PDE Listener.

Please help! And thanks in advance!

Jack
Re: More help with RCP app/SWTBot/ANT [message #35500 is a reply to message #35466] Sat, 16 May 2009 03:24 Go to previous message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
Messages: 873
Registered: July 2009
Senior Member
On 16/5/09 03:10, Jack Markarian wrote:
>
>
> C:\eclipse-rcp-ganymede-SR2-win32\eclipse\plugins>ant test
> Buildfile: build.xml
>
> test:
>
> listen:
> [echo] Debut target listen
> [java] java.lang.NoClassDefFoundError:
> org/eclipse/jdt/internal/junit/model/ITestRunListener2
> [java] at java.lang.ClassLoader.defineClass1(Native Method)
> [java] at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
> [java] at
> org.apache.tools.ant.AntClassLoader.defineClassFromData(AntC lassLoader.java:1130)
>

Seems that the pde test runner is not able to find this class. The pde
test runner is not an eclipse plugin -- just a simple java program that
needs some eclipse plugins as simple jars:

<java classname="pde.test.utils.PDETestResultsCollector">
<arg line="demotest 2625" />
<fileset dir="/folder/containing/pde-test/utils" include="*.jar" />
<fileset dir="/path/to/eclipse/plugins" include="**/*.jar" />
</java>

-- Ketan
Previous Topic:SWTBot support for GEF
Next Topic:Back in action
Goto Forum:
  


Current Time: Fri Apr 26 22:08:33 GMT 2024

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

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

Back to the top