Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » SWTBot/Ant
SWTBot/Ant [message #515529] Fri, 19 February 2010 09:39 Go to next message
David CHAUTARD is currently offline David CHAUTARDFriend
Messages: 102
Registered: July 2009
Senior Member
Hello,
I try to run my tests (JUnit + SWTBot), and to generate a junitreport (in html) using Ant.

I have my tests class :
@RunWith(SWTBotJunit4ClassRunner.class)
@SuiteClasses({MyTest1.class, MyTest2.class})
public class AllTests {
}

Nevertheless, I have some problems to execute my tests. I try to use http://wiki.eclipse.org/SWTBot/Ant tutorial, but I don't know how to use Ant, buildTest.xml, and library.xml.

I create a buildTest.xml :
<?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="myPlugin.test"/>
    <property name="test-classname" value="AllTests"/>
    <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>

I don't understand if I have create my own library.xml file or use the org.eclipse.swtbot.eclipse.junit4.headless_***/library.xml. And I don't know how I launch the tests :
- launching build.xml with Ant
- or in command line, but how to manage build.xml with this code example of the tutorial :
<echo>SWTBot test</echo>
<java dir="${eclipse.home}" fork="true" output="${eclipse.test.home}/output.txt" logError="true" classname="org.eclipse.core.launcher.Main" failonerror="false">
	<classpath>
		<fileset dir="${eclipse.home}/plugins">
			<include name="org.eclipse.equinox.launcher_*.jar"/>
		</fileset>
	</classpath>
	<arg line="-application org.eclipse.swtbot.eclipse.junit4.headless.swtbottestapplication"/>
	<arg line="-testApplication [my.test.application]"/>
	<arg line="-testPluginName [my.test.plugin]"/>
	<arg line="-testApplication [my.test.application]"/>
	<arg line="-className [my.swtbot.TestSuite]"/>
	<arg line="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,junit-results.xml"/>
	<arg line="-consoleLog"/>
	<jvmarg line="-Xms40m -Xmx348m -XX:MaxPermSize=512m"/>
</java> 


I'm sorry if my questions are a little bit simples, but I am currently blocked on this point.

Thanks for your help,
David.
Re: SWTBot/Ant [message #515578 is a reply to message #515529] Fri, 19 February 2010 12:47 Go to previous messageGo to next message
Mickael Istria is currently offline Mickael IstriaFriend
Messages: 865
Registered: July 2009
Location: Grenoble, France
Senior Member

Hello,

To run SWTBot tests headlessly, you need:
* Your product with your plugins installed
* To install your test plugins, and SWTBot plugins and fragments and their dependency installed in product.

Then you can invoke the headless testing from command-line or Ant, as described in the wiki page http://wiki.eclipse.org/SWTBot/Ant
The library.xml file is a wrapper for invocation of tests with Ant, if you use the command-line or the ant command to start them, you won't need it.

HTH

David CHAUTARD a écrit :
> Hello,
> I try to run my tests (JUnit + SWTBot), and to generate a junitreport
> (in html) using Ant.
>
> I have my tests class :
> @RunWith(SWTBotJunit4ClassRunner.class)
> @SuiteClasses({MyTest1.class, MyTest2.class})
> public class AllTests {
> }
> Nevertheless, I have some problems to execute my tests. I try to use
> http://wiki.eclipse.org/SWTBot/Ant tutorial, but I don't know how to use
> Ant, buildTest.xml, and library.xml.
>
> I create a buildTest.xml :
> <?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="myPlugin.test"/>
> <property name="test-classname" value="AllTests"/>
> <property name="library-file"
> value=" ${eclipse-home}/plugins/org.eclipse.swtbot.eclipse.junit4.he adless_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>
> I don't understand if I have create my own library.xml file or use the
> org.eclipse.swtbot.eclipse.junit4.headless_***/library.xml. And I don't
> know how I launch the tests : - launching build.xml with Ant - or in
> command line, but how to manage build.xml with this code example of the
> tutorial :
> <echo>SWTBot test</echo>
> <java dir="${eclipse.home}" fork="true"
> output="${eclipse.test.home}/output.txt" logError="true"
> classname="org.eclipse.core.launcher.Main" failonerror="false">
> <classpath>
> <fileset dir="${eclipse.home}/plugins">
> <include name="org.eclipse.equinox.launcher_*.jar"/>
> </fileset>
> </classpath>
> <arg line="-application
> org.eclipse.swtbot.eclipse.junit4.headless.swtbottestapplica tion "/>
> <arg line="-testApplication [my.test.application]"/>
> <arg line="-testPluginName [my.test.plugin]"/>
> <arg line="-testApplication [my.test.application]"/>
> <arg line="-className [my.swtbot.TestSuite]"/>
> <arg
> line=" formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJU nitResultFormatter,junit-results.xml "/>
>
> <arg line="-consoleLog"/>
> <jvmarg line="-Xms40m -Xmx348m -XX:MaxPermSize=512m"/>
> </java>
> I'm sorry if my questions are a little bit simples, but I am currently
> blocked on this point.
>
> Thanks for your help,
> David.

--
Mickael Istria - BonitaSoft S.A.
http://www.bonitasoft.com/products/downloads.php
Re: SWTBot/Ant [message #515599 is a reply to message #515578] Fri, 19 February 2010 14:05 Go to previous messageGo to next message
David CHAUTARD is currently offline David CHAUTARDFriend
Messages: 102
Registered: July 2009
Senior Member
Hello;
thanks for your answer.
When I launch my tests with "SWTBot test" in Eclipse, I export a xml file containing my results. And I would like to transform this file with JUnitReport in order to get an HTML report.
That's why I use Ant to generate the first XML file, and then to get the report without using Eclipse), to compae the XML with my previous file.
Because the report displays "Tests:0 , Failures:0, Errors:0" while the JUnit view in Eclipse displays 3 succedeed tests. I think my XML file has not the good structure, And I don't know how to manage this transformation.

Do you have an idea?

Thanks,
David.
Re: SWTBot/Ant [message #515634 is a reply to message #515599] Fri, 19 February 2010 15:14 Go to previous messageGo to next message
Mickael Istria is currently offline Mickael IstriaFriend
Messages: 865
Registered: July 2009
Location: Grenoble, France
Senior Member

You could run an XSL Transformation to transform your XML file into an HTML report. I think that the task defined in library.xml shows you how to perform this transformation, and that some XSL are available beside of it.
Hower the "Tests:0 , Failures:0, Errors:0" tells you that no test was run. Did you forget some @Test annotation, or to start your test methods with test... ?

David CHAUTARD a écrit :
> Hello;
> thanks for your answer.
> When I launch my tests with "SWTBot test" in Eclipse, I export a xml
> file containing my results. And I would like to transform this file with
> JUnitReport in order to get an HTML report.
> That's why I use Ant to generate the first XML file, and then to get the
> report without using Eclipse), to compae the XML with my previous file.
> Because the report displays "Tests:0 , Failures:0, Errors:0" while the
> JUnit view in Eclipse displays 3 succedeed tests. I think my XML file
> has not the good structure, And I don't know how to manage this
> transformation.
>
> Do you have an idea?
>
> Thanks,
> David.
>


--
Mickael Istria - BonitaSoft S.A.
http://www.bonitasoft.com/products/downloads.php
Re: SWTBot/Ant [message #515641 is a reply to message #515634] Fri, 19 February 2010 15:43 Go to previous messageGo to next message
David CHAUTARD is currently offline David CHAUTARDFriend
Messages: 102
Registered: July 2009
Senior Member
Hy,

I use @Test annotation for my methods which begin with test.

Quote:
You could run an XSL Transformation to transform your XML file into an HTML report.

I run Junit + SWTBot tests with Eclipse, and I export result in XML. And I would like to use JUnitreport to transform my XML file to HTML. I get the following file :
<?xml version="1.0" encoding="UTF-8"?>
<testrun name="SWTBotSuite" project="myplugin.test" tests="4" started="4" failures="0" errors="0" ignored="0">
  <testsuite name="myplugin.test.AllTests" time="31.312">
    <testsuite name="myplugin.test.EditorTest" time="12.328">
      <testcase name="testSWTBotcreateProject" classname="myplugin.test.EditorTest" time="4.625"/>
      <testcase name="testSWTBotcreateEditor" classname="myplugin.test.EditorTest" time="7.703"/>
    </testsuite>
    <testsuite name="myplugin.test.PreferencesPageTest" time="18.984">
      <testcase name="testAllDeselectPage" classname="myplugin.test.PreferencesPageTest" time="10.484"/>
      <testcase name="testSelectAllPages" classname="myplugin.test.PreferencesPageTest" time="8.5"/>
    </testsuite>
  </testsuite>
</testrun>


I have the message "SWTBotSuite.xml is not a valid testsuite XML document" when I launch JUnitreport. And If I remove <testrun> tag, I can generate a HTML file, and my TEST-testsuite.xml file :
<?xml version="1.0" encoding="UTF-8" ?>
<testsuites>
  <testsuite id="0" name="AllTests" package="myplugin.test" time="31.312">
        <testsuite name="myplugin.test.EditorTest" time="12.328">
            <testcase classname="myplugin.test.EditorTest" name="testSWTBotcreateProject" time="4.625" />
            <testcase classname="myplugin.test.EditorTest" name="testSWTBotcreateEditor" time="7.703" />
        </testsuite>

        <testsuite name="myplugin.test.PreferencesPageTest" time="18.984">
            <testcase classname="myplugin.test.PreferencesPageTest" name="testAllDeselectPage" time="10.484" />
            <testcase classname="myplugin.test.PreferencesPageTest" name="testSelectAllPages" time="8.5" />
        </testsuite>

    </testsuite>
</testsuites>

and in my HTML report, I have "Tests:0 , Failures:0, Errors:0"

Do you know what can be the problem?

Thx.
Re: SWTBot/Ant [message #515660 is a reply to message #515641] Fri, 19 February 2010 16:03 Go to previous messageGo to next message
Mickael Istria is currently offline Mickael IstriaFriend
Messages: 865
Registered: July 2009
Location: Grenoble, France
Senior Member

Sorry, I did not understand what you meant before. Then it seems your test are working well. Great!
However, we don't use HTML reports here (we have reports in Hudson), so that I won't be able to help you on this topic.

Good luck!

--
Mickael Istria - BonitaSoft S.A.
http://www.bonitasoft.com/products/downloads.php
Re: SWTBot/Ant [message #515730 is a reply to message #515660] Sat, 20 February 2010 00:03 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
Messages: 873
Registered: July 2009
Senior Member
The test.xml generated by eclipse is not exactly JUnit conformant.

There's a junit.xsl supplied with the headless runner which should be
the right xsl for the job.

Cheers!

-- Ketan

On 2/19/10 9:33 PM, Mickael Istria wrote:
> Sorry, I did not understand what you meant before. Then it seems your
> test are working well. Great!
> However, we don't use HTML reports here (we have reports in Hudson), so
> that I won't be able to help you on this topic.
>
> Good luck!
>
> --
> Mickael Istria - BonitaSoft S.A.
> http://www.bonitasoft.com/products/downloads.php
Re: SWTBot/Ant [message #516234 is a reply to message #515730] Tue, 23 February 2010 10:19 Go to previous messageGo to next message
David CHAUTARD is currently offline David CHAUTARDFriend
Messages: 102
Registered: July 2009
Senior Member
Hy Ketan,
thanks for your answer.

I try to run my tests with ant in order to get a xml result which is JUnit conformant, to get finally a HTML report. But I have some problem to launch my application and to run my tests. Because I think my application has to be launch in order to run the SWTBot tests.

I find to ways to run my tests but none work :

The first way run all my tests, but they are all failed :
<project name="fr.actia.actidiag-feature" default="reports">
<target name="reports" depends="">
<mkdir dir=""/>
	
	<path id="classpath">
		<pathelement location="E:\Eclipse3.5_SWTBot\eclipse\plugins\org.junit4_4.5.0.v20090824\junit.jar" />
		<pathelement location="myPluginPath\bin\" />
	</path>

	<junit fork="yes" printsummary="yes" haltonfailure="no">
	    <batchtest fork="yes" todir="myPluginPath" >
	      <fileset dir="myPluginPath\bin">
	      	 <include name="**/*Test.class" />
	      </fileset>
	    </batchtest>
	    <formatter type="xml" />
		<classpath refid="classpath"/>
	  </junit>
	
	<junitreport todir="">
		<fileset dir="myPluginPath">
			<include name="*.xml"/>
			<exclude name="TESTS-TestSuites.xml"/>
		</fileset>
		<report format="noframes" todir="myPluginPath"/>
	</junitreport>
</target>
</project>


The second way launch an Eclipse product, but not my product and I have a Exception in thread "WorkbenchTestable" java.lang.NoClassDefFoundError: junit/framework/TestListener exception, and my tests are not run :
<?xml version="1.0" encoding="UTF-8" ?>
<project name="testsuite" default="run" basedir=".">
	<property name="eclipse-home" value="E:/Eclipse3.5_SWTBot/eclipse" />
	<property name="plugin-name" value="MyPluginName" />
	<property name="library-file" value="${eclipse-home}/plugins/org.eclipse.swtbot.eclipse.junit4.headless_2.0.0.187-dev/library.xml"/>
	<property name="test-classname" value="MyPlugin.AllTests"/>
	<property name="testProduct" value="myproduct"/>
	<property name="testApplication" value="myapplication"/>

   <target name="suite">
		<property name="jvmOption" value=""></property>
		<property name="temp-workspace" value="workspace" />
		<delete dir="${temp-workspace}" quiet="true" />

     <ant target="swtbot-test" antfile="${library-file}" dir="${eclipse-home}">
           <property name="data-dir" value="${temp-workspace}" />
           <property name="testProduct" value="${testApplication}" />
		   <property name="testApplication" value="${testApplication}" />
           <property name="plugin-name" value="${plugin-name}" />
    	   <property name="os" value="win32"/>
		   <property name="ws" value="win32"/>
		   <property name="arch" value="x86" />
           <property name="classname" value="${test-classname}" />
           <property name="vmargs" value=" -Xms128M -Xmx512M -XX:MaxPermSize=512M ${jvmOption}" />
       </ant>
   </target>

   <target name="cleanup" />

   <target name="run" depends="suite,cleanup">
       <ant target="collect" antfile="${library-file}" dir="${eclipse-home}">
           <property name="includes" value="*.xml" />
           <property name="output-file" value="${plugin-name}.xml" />
       </ant>
   </target>
</project>


What is the best way to continue, and how can I correct my problems?

Thanks,
David.

[Updated on: Tue, 23 February 2010 10:43]

Report message to a moderator

Re: SWTBot/Ant [message #516347 is a reply to message #516234] Tue, 23 February 2010 16:13 Go to previous messageGo to next message
David CHAUTARD is currently offline David CHAUTARDFriend
Messages: 102
Registered: July 2009
Senior Member
Hy,
I think the way to continue is the second one. But I can't launch my product. What properties should I change? Because I add testProduct and testApplication properties but it changes nothing.

Thanks for your help,
David.
Re: SWTBot/Ant [message #516355 is a reply to message #516347] Tue, 23 February 2010 12:02 Go to previous messageGo to next message
Mickael Istria is currently offline Mickael IstriaFriend
Messages: 865
Registered: July 2009
Location: Grenoble, France
Senior Member

I wrote a blog entry a few weeks ago to explain how we get SWTBot working over Ant in a headless build process here, in case it may help:
http://www.bonitasoft.org/blog/?p=335

Hope this helps...

David CHAUTARD a écrit :
> Hy,
> I think the way to continue is the second one. But I can't launch my
> product. What properties should I change? Because I add testProduct and
> testApplication properties but it changes nothing.
>
> Thanks for your help,
> David.


--

--
Mickael Istria - BonitaSoft S.A.
http://www.bonitasoft.com/products/downloads.php
Re: SWTBot/Ant [message #516498 is a reply to message #516355] Wed, 24 February 2010 09:04 Go to previous messageGo to next message
David CHAUTARD is currently offline David CHAUTARDFriend
Messages: 102
Registered: July 2009
Senior Member
Hello Mickael,

I try tu use your blog entry, but I have the error : junit.framework.AssertionFailedError: null.

Do you know what can be the problem?

Thanks,
David.
Re: SWTBot/Ant [message #516513 is a reply to message #516498] Wed, 24 February 2010 10:15 Go to previous messageGo to next message
Mickael Istria is currently offline Mickael IstriaFriend
Messages: 865
Registered: July 2009
Location: Grenoble, France
Senior Member

David CHAUTARD a écrit :
> Hello Mickael,
>
> I try tu use your blog entry, but I have the error :
> junit.framework.AssertionFailedError: null.
> Do you know what can be the problem?
>
> Thanks,
> David.

This is a JUnit error, which probably means that your tests are actually run, but that an assertNotNull statement fails in a TestCase. The output results for your tests should be available in the home folder of the product your are testing (this is defined in the formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJU nitResultFormatter,junit-results-swtbot.xml option).

If you get a results file, then congrats, you are done with your SWTBot/Ant integration. The only thing you have to do is to make your tests green.

--
Mickael Istria - BonitaSoft S.A.
http://www.bonitasoft.com/products/downloads.php
Re: SWTBot/Ant [message #516521 is a reply to message #516513] Wed, 24 February 2010 10:50 Go to previous messageGo to next message
David CHAUTARD is currently offline David CHAUTARDFriend
Messages: 102
Registered: July 2009
Senior Member
Hy,
Quote:
which probably means that your tests are actually run

I don't think that the tests are run, because the application are not launch. I have also the message !MESSAGE Product myproduct could not be found., as I have :
<echo>SWTBot test</echo>
	<java dir="${eclipse-home}" fork="true" output="${eclipse-home}/output.txt" logError="true" classname="org.eclipse.core.launcher.Main" failonerror="false">
		<classpath>
			<fileset dir="${eclipse-home}/plugins">
				<include name="org.eclipse.equinox.launcher_*.jar"/>
			</fileset>
		</classpath>
		<arg line="-application org.eclipse.swtbot.eclipse.core.swtbottestapplication"/>
		<arg line="-testPluginName myplugin.test"/>
		<arg line="-testApplication myapplication"/>
		<arg line="-myproduct"/>
		<arg line="-className myplugin.test.AllTests"/>
		<arg line="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,junit-results.xml"/>
		<arg line="-consoleLog"/>
		<arg line="-data E:\junit-workspace" />
	<jvmarg line="-Xms768m -Xmx768m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled -Dsun.java2d.d3d=false"/>
	</java>

I don't know why my product can't be found. Maybe I have to specify the config.ini file.

David.

[Updated on: Wed, 24 February 2010 10:51]

Report message to a moderator

Re: SWTBot/Ant [message #516529 is a reply to message #516521] Wed, 24 February 2010 06:06 Go to previous messageGo to next message
Mickael Istria is currently offline Mickael IstriaFriend
Messages: 865
Registered: July 2009
Location: Grenoble, France
Senior Member

Is your application name really "myapplication"?
If you defined it in a plugin called for instance "fr.actia.gpctool.application", with an extension id "myapplication", then its name is "fr.actia.gpctool.application.myapplication". You can see the list of available application in your .product editor, or by typning from your product "java -jar plugins/org.eclipse.equinox.launcher_*.jar -application aFakeId -consoleLog" which will give you an error message containing the list of available applications.

David CHAUTARD a écrit :
> Hy,
> Quote:
>> which probably means that your tests are actually run
>
> I don't think that the tests are run, because the application are not
> launch. I have also the message !MESSAGE Product myproduct could not be
> found., as I have :
> <echo>SWTBot test</echo>
> <java dir="${eclipse-home}" fork="true"
> output="${eclipse-home}/output.txt" logError="true"
> classname="org.eclipse.core.launcher.Main" failonerror="false">
> <classpath>
> <fileset dir="${eclipse-home}/plugins">
> <include name="org.eclipse.equinox.launcher_*.jar"/>
> </fileset>
> </classpath>
> <arg line="-application
> org.eclipse.swtbot.eclipse.core.swtbottestapplication"/>
> <arg line="-testPluginName fr.actia.gpctool.editor.test"/>
> <arg line="-testApplication myapplication"/>
> <arg line="-myproduct"/>
> <arg line="-className fr.actia.extensions.test.AllTests"/>
> <arg
> line=" formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJU nitResultFormatter,junit-results.xml "/>
>
> <arg line="-consoleLog"/>
> <arg line="-data E:\Actia\junit-workspace" />
> <jvmarg line="-Xms768m -Xmx768m -XX:PermSize=256m
> -XX:MaxPermSize=256m -XX:+CMSPermGenSweepingEnabled
> -XX:+CMSClassUnloadingEnabled -Dsun.java2d.d3d=false"/>
> </java>
> I don't know why my product can't be found. Maybe I have to specify the
> config.ini file.
>
> David.


--

--
Mickael Istria - BonitaSoft S.A.
http://www.bonitasoft.com/products/downloads.php
Re: SWTBot/Ant [message #516566 is a reply to message #516529] Wed, 24 February 2010 12:22 Go to previous messageGo to next message
David CHAUTARD is currently offline David CHAUTARDFriend
Messages: 102
Registered: July 2009
Senior Member
Sorry,
my application name is not "myapplication", it's just a generic name.
I get the application name, with the .product file, which is used to launch my application. But how can I specify the product to launch, because we can see testProduct and product?

Thanks,
David.
Re: SWTBot/Ant [message #516582 is a reply to message #516566] Wed, 24 February 2010 13:24 Go to previous messageGo to next message
David CHAUTARD is currently offline David CHAUTARDFriend
Messages: 102
Registered: July 2009
Senior Member
I have an other question. On the http://wiki.eclipse.org/SWTBot/Ant it said
Quote:
org.junit4 (or org.junit, but not both)

But how can I remove one of them? Because if I remove org.junit, I have error in my .product file and my ant files. And if I remove org.junit4 I have problems to use org.eclipse.swtbot.eclipse.junit4.headless.swtbottestapplica tion

Thx,
David.
Re: SWTBot/Ant [message #516589 is a reply to message #516582] Wed, 24 February 2010 13:46 Go to previous messageGo to next message
Mickael Istria is currently offline Mickael IstriaFriend
Messages: 865
Registered: July 2009
Location: Grenoble, France
Senior Member

In the blog post I pointed you, I suggest to use the new JUnit bundles in your test feature to fulfill both dependency and keep SWTBot working. See http://wiki.eclipse.org/Eclipse/Testing/JUnit4_Changes for more details, and the blog entry for application.
I hope next release of SWTBot will follow this move... ;) (I could help on this topic by the way).

David CHAUTARD a écrit :
> I have an other question. On the http://wiki.eclipse.org/SWTBot/Ant it
> said Quote:
>> org.junit4 (or org.junit, but not both)
>
> But how can I remove one of them? Because if I remove org.junit, I have
> error in my .product file and my ant files. And if I remove org.junit4 I
> have problems to use
> org.eclipse.swtbot.eclipse.junit4.headless.swtbottestapplica tion
>
> Thx,
> David.


--
Mickael Istria - BonitaSoft S.A.
http://www.bonitasoft.com/products/downloads.php
Re: SWTBot/Ant [message #516670 is a reply to message #516589] Wed, 24 February 2010 17:38 Go to previous messageGo to next message
David CHAUTARD is currently offline David CHAUTARDFriend
Messages: 102
Registered: July 2009
Senior Member
Hello,
I use Junit4, but I need Junit for Ant for example.
And I use
<arg line="-testLoaderClass org.eclipse.jdt.internal.junit.runner.junit4.JUnit4TestLoader"/>

to launch my application, in order to use Junit4.

Nevertheless, when I run the Ant, I have the error :
Exception in thread "WorkbenchTestable" java.lang.IllegalArgumentException: 
Error: test loader org.eclipse.jdt.internal.junit.runner.junit4.JUnit4TestLoader not found: 
java.lang.ClassNotFoundException: org.eclipse.jdt.internal.junit.runner.junit4.JUnit4TestLoader

and an Eclipse product is open, but not my product.

Do you think there is a link between the error and the product launch? Otherwise, how can I launch my own product?

Thx,
David.
Re: SWTBot/Ant [message #516829 is a reply to message #516670] Thu, 25 February 2010 10:02 Go to previous messageGo to next message
David CHAUTARD is currently offline David CHAUTARDFriend
Messages: 102
Registered: July 2009
Senior Member
Hy,

I found the solution to launch my own product and to run my tests Smile
Thanks Mickael for your valuable help.

This is the ant I use to launch my product with tests :
<java dir="${eclipse-home}" fork="true" output="${eclipse-home}/output.txt" logError="true" classname="org.eclipse.core.launcher.Main" failonerror="false">
		<classpath>
			<fileset dir="${eclipse-home}/plugins">
				<include name="org.eclipse.equinox.launcher_*.jar"/>
			</fileset>
		</classpath>
		<arg line="-product myproduct"/>
		<arg line="-application org.eclipse.swtbot.eclipse.junit4.headless.swtbottestapplication"/>
		<arg line="-testApplication myapplication"/>
		<arg line="-testPluginName myPlugin.test"/>
		<arg line="-className AllTests"/>
		<arg line="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,junit-results.xml"/>
		<arg line="-os win32"/>
		<arg line="-ws win32"/> 
		<arg line="-arch x86"/>
		<arg line="-configuration file:E:/WorkspaceGalileo/.metadata\.plugins/org.eclipse.pde.core/pde-junit\"/>
		<arg line="-dev file:E:/WorkspaceGalileo/.metadata/.plugins/org.eclipse.pde.core/pde-junit/dev.properties"/>
		<arg line="-testLoaderClass org.eclipse.jdt.internal.junit.runner.junit4.JUnit4TestLoader"/>
		<arg line="-loaderPluginName org.eclipse.jdt.junit4.runtime"/>
		<arg line="-consoleLog"/>
		<arg line="-data E:\junit-workspace"/>
	<jvmarg line="-Xms768m -Xmx768m -XX:PermSize=256m -XX:MaxPermSize=256m"/>
</java>

I use : "-product my.product
-application org.eclipse.swtbot.eclipse.junit4.headless.swtbottestapplica tion
-testApplication my.application"
instead of "-testProduct", in this particular order.

David.
Re: SWTBot/Ant [message #660139 is a reply to message #516829] Thu, 17 March 2011 02:15 Go to previous message
benhu Missing name is currently offline benhu Missing nameFriend
Messages: 14
Registered: October 2010
Junior Member

Hello David,
I also block in this point, what's worse, i not familiar with Ant.

Can you show me how you wrote you build.xml?
and do i just need only this file?

Thanks a lot.
Previous Topic:delete the topic
Next Topic:Running SWTbot test from Java Program
Goto Forum:
  


Current Time: Thu Mar 28 22:16:36 GMT 2024

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

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

Back to the top