Automating the launch of SWTBot tests with Ant [message #28047] |
Tue, 17 March 2009 04:57  |
Eclipse User |
|
|
|
Hi,
This thread follows a discussion started in an old one "Start SWTbotTest
from Java Application". I started a new one because the subject of the
previous one was not exactly that (and has become long).
I want to fully automate the launch of my tests (of an RCP app), with the
help of an Ant script.
If so I'll be able to run the tests with just launching one .bat file.
This is really interesting and I think it gives value added to SwtBot.
Below is an extract from previous talk. The links are interesting.
If you have any clue please tell me.
@Hugulas Chen:
Did you get time to achieve the paper you're talking about?
Marc
********************
> From hugulas chen:
I am already using ant script to test my rcp automatically.
First, you need to install your test plugins under eclipse plugin dir.
Then,you can run such a parallel task.It contains two threads: execute and
listen.
Execute Task will start your eclipse and execute your test case.
Listen task will collect the test result.
The listener can be downloaded from
http://www.eclipse.org/articles/Article-PDEJUnitAntAutomatio n/PDETestExampleProjects-3.3.zip.
This task can run one case each.I wrote a small tool to generate the test
case name list. Finally, you can use junitreport task to generate the test
report.
Ketan, may I contribute a paper about how to automate the swtbot test with
ant?
<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>${test.workspace}</echo>
<delete dir="${test.workspace}" />
<mkdir dir="${test.workspace}" />
<java classname="org.eclipse.equinox.launcher.Main" fork="true"
dir="${build.home}" output="reports/${testcase}.out.txt"
error="reports/${testcase}.err.txt" append="true">
<arg line="-application
org.eclipse.swtbot.eclipse.core.swtbottestapplication" />
<arg line="-classNames ${testcase} -testpluginname ${testplugin}" />
<arg line="-version 3 -testLoaderClass
org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader -loaderpluginname
org.eclipse.jdt.junit4.runtime" />
<arg line="-port 2625 -pdelaunch" />
<arg line="-data ${test.workspace}" />
<arg line="-debug -consolelog -clean" />
<classpath>
<fileset dir="${build.plugins}">
<include name="org.eclipse.equinox.launcher_*.jar" />
</fileset>
</classpath>
</java>
</target>
<target name="listen">
<java classname="pde.test.utils.PDETestResultsCollector">
<arg line="${testcase} 2625" />
<classpath>
<fileset dir="${build.plugins}">
<include name="**/*.jar" />
</fileset>
<fileset dir="lib">
<include name="**/*.jar" />
</fileset>
<fileset dir="${java.home}/lib">
<include name="**/*.jar" />
</fileset>
</classpath>
</java>
</target>
http://www.eclipse.org/articles/Article-PDE-Automation/autom ation.html
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Automating the launch of SWTBot tests with Ant [message #635762 is a reply to message #28047] |
Wed, 27 October 2010 22:25   |
Eclipse User |
|
|
|
Hi all,
I'm very new to SWTBot. So, could you please explain more details about how to use ant to run a test case.
What I already have now:
- A RCP Application source code.
- A Test Case to test the RCP App. In Dependencies, I already added these plugins: org.eclipse.swtbot.swt.finder, org.eclipse.swtbot.eclipse.finder, org.hamcrest, org.junit4.
- Headless Junit testing framework has been downloaded and copy to the Eclipse plugin folder.
- TestCase has been exported into jar and copy into the eclipse plugin.
- ant can run the test case sucessfully but cannot launch the RCP application.
What I do not know is how and where I have to config to let ant able to launch the specified RCP application. The video demo from Ketan just shows how to use ant to launch and test an Eclipse window, not an specified Application. I've already looked at build.xml and library.xml, but still not understand much cuz these files doesn't have clear comments inside.
BTW, in this link http://wiki.eclipse.org/SWTBot/Ant, Ketan mentions about using command line to run the test but I really don't know how to? could you guys can explain more?
Very appreciate!
Toni
|
|
|
|
Powered by
FUDForum. Page generated in 0.04519 seconds