Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Launch SWTBot test on generated RCP product
Launch SWTBot test on generated RCP product [message #509152] Thu, 21 January 2010 14:24 Go to next message
David CHAUTARD is currently offline David CHAUTARDFriend
Messages: 102
Registered: July 2009
Senior Member

I try to test my RCP application with SWTBot.
When I launch my tests with my product (Run As "SWTBot test"), my tests are running. Nevertheless I would like to test a generated product that users will use.

So, I export my SWTBot test plugin and Igenerate a RCP product. I add :
SWTBot plugins
my exported test plugin

to the plugins directory.

I add this to my .product file
      <feature id="myswtbotPlugin"/>
      <feature id="org.eclipse.swtbot"/>
      <feature id="org.eclipse.swtbot.eclipse"/>
      <feature id="org.eclipse.swtbot.eclipse.test"/>

And I create Ant to launch my test on my genereted RCP.
The build.xml is:
<?xml version="1.0" encoding="UTF-8" ?>
<project name="testsuite" default="run" basedir=".">
    <property name="eclipse-home" value="E:/RCP/SWTBot"/>
    <property name="plugin-name" value="myswtbotPlugin"/>
    <property name="test-classname" value="MyTest"/>
    <property name="library-file" value="${eclipse-home}/plugins/org.eclipse.swtbot.eclipse.junit4.headless_2.0.0.187-dev/library.xml"/>
    <target name="suite">
	<property name="jvmOption" value=""></property>
		<property name="temp-workspace" value="workspace" />
	<ant target="swtbot-test" antfile="${library-file}" dir="${eclipse-home}">
            <property name="data-dir" value="${temp-workspace}" />
            <property name="plugin-name" value="${plugin-name}" />
	    <property name="os" value="win32" />
	    <property name="ws" value="workspace" />
	    <property name="arch" value="x86" />
            <property name="classname" value="${test-classname}" />
            <property name="vmargs" value=" -Xms128M -XX:MaxPermSize=512M -Xmx512M"/>
    <target name="cleanup" />
    <target name="run" depends="suite,cleanup">

But I have the following error :
java.lang.RuntimeException: Application " org.eclipse.swtbot.eclipse.junit4.headless.swtbottestapplica tion " could not be found in the registry.

I look at but I don't know what I have forgotten.

Can someone help me please?
Re: Launch SWTBot test on generated RCP product [message #509575 is a reply to message #509152] Sat, 23 January 2010 01:51 Go to previous messageGo to next message
linlei  is currently offline linlei Friend
Messages: 2
Registered: January 2010
Junior Member
I have exact same problem. what I did is to edit the library.xml in the org.eclipse.swtbot.eclipse.junit4.headless_xxx folder.
Change the application to your application id.

<antcall target="${launchTarget}">
<param name="application" value="your application"/>
<!--param name="application" value=" org.eclipse.swtbot.eclipse.junit4.headless.swtbottestapplica tion " /-->

It should work. But I got another problem. I could not get my tests to run after bringing the product up.

Please let me know if your tests can be run correctly.

Re: Launch SWTBot test on generated RCP product [message #510013 is a reply to message #509575] Tue, 26 January 2010 08:34 Go to previous message
David CHAUTARD is currently offline David CHAUTARDFriend
Messages: 102
Registered: July 2009
Senior Member
Hi linlei ,
thanks for your answer.
But have I to add your code
to mine or to replace my code
with yourth?
Besides, I would like to know if ${launchTarget} is the install path to my generated product, and if "my application" is my product or my genetated exe.
ex :
<property name="launchTarget" value="E:/RCP/SWTBot"/>
<property name="application" value="myrcp.exe"/>

Thanks a lot,
Previous Topic:Is record/playback supported in latest swtbot?
Next Topic:Where can I find headless test bundles?
Goto Forum:

Current Time: Wed Dec 01 20:53:19 GMT 2021

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

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

Back to the top