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 09:24 Go to next message
David CHAUTARD is currently offline David CHAUTARD
Messages: 102
Registered: July 2009
Senior Member
Hello,

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
org.eclipse.swtbot.eclipse.junit4.headless
org.eclipse.swtbot.ant.optional.junit4.jar
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"/>
        </ant>
    </target>
 
    <target name="cleanup" />
 
    <target name="run" depends="suite,cleanup">
    </target>
 
</project>


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


I look at http://wiki.eclipse.org/SWTBot/Troubleshooting but I don't know what I have forgotten.

Can someone help me please?
Thanks,
David.
Re: Launch SWTBot test on generated RCP product [message #509575 is a reply to message #509152] Fri, 22 January 2010 20:51 Go to previous messageGo to next message
linlei  is currently offline linlei
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 " /-->
</antcall>


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.

Thanks.
Re: Launch SWTBot test on generated RCP product [message #510013 is a reply to message #509575] Tue, 26 January 2010 03:34 Go to previous message
David CHAUTARD is currently offline David CHAUTARD
Messages: 102
Registered: July 2009
Senior Member
Hi linlei ,
thanks for your answer.
But have I to add your code
Quote:
<antcall>...<antcall/>
to mine or to replace my code
Quote:
<ant>...<ant/>
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,
David.
Previous Topic:Is record/playback supported in latest swtbot?
Next Topic:Where can I find headless test bundles?
Goto Forum:
  


Current Time: Wed Aug 20 06:45:33 EDT 2014

Powered by FUDForum. Page generated in 0.02135 seconds