Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Launching Unit Tests with the Testframework for an RCP Application
Launching Unit Tests with the Testframework for an RCP Application [message #458440] Mon, 20 November 2006 12:16 Go to next message
Eclipse UserFriend
Hi all,
I am setting up an Integration Buildsystem for a RCP Application. After
building the product, I want to run the Unit tests. To do this I created
a test.xml. This snippet shows the call to the libary.xml of the test
plugin:

<target name="suite">
<delete dir="${tests-workspace}" quiet="true"/>
<echo message="stx-folder: ${tests-workspace}"/>
<ant target="ui-test" antfile="${library-file}"
dir="${stixdb_test_app}">
<property name="data-dir" value="${tests-workspace}"/>
<property name="plugin-name" value="${plugin-name}"/>
<property name="classname"
value="de.aysada.stixdb.AllStiXDBTests"/>
</ant>
</target>

This launches the Test but I got this Exception:

[java] [java] junit.framework.AssertionFailedError
[java] [java] at
junit.framework.Assert.fail(Assert.java:47)
[java] [java] at
junit.framework.Assert.assertTrue(Assert.java:20)
[java] [java] at
junit.framework.Assert.assertNotNull(Assert.java:220)
[java] [java] at
junit.framework.Assert.assertNotNull(Assert.java:213)
[java] [java] at
org.eclipse.test.UITestApplication.getApplication(UITestAppl ication.java:93)
[java] [java] at
org.eclipse.test.UITestApplication.run(UITestApplication.jav a:49)
[java] [java] at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:78)
[java] [java] at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:92)
[java] [java] at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:68)
[java] [java] at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)
[java] [java] at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)
[java] [java] at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] [java] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
[java] [java] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)

[java] [java] at
java.lang.reflect.Method.invoke(Method.java:585)
[java] [java] at
org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 )
[java] [java] at
org.eclipse.core.launcher.Main.basicRun(Main.java:280)
[java] [java] at
org.eclipse.core.launcher.Main.run(Main.java:977)
[java] [java] at
org.eclipse.core.launcher.Main.main(Main.java:952)

In the code I saw, that I have to set the Test Application ID. I found
no property to set this.

My quick solution is to patch the libary.xml and it works.

What is the correct way to specify the test application?

karsten
Re: Launching Unit Tests with the Testframework for an RCP Application [message #458600 is a reply to message #458440] Wed, 22 November 2006 19:36 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: aarati_k.yahoo.com

If you follow the Eclipse testing workflow, you will notice that there are 2 test.xml files one at top level and other in the plugin directory.

The top level derives the plugin name from the test.properties file , copies the required test plugins to test eclipse setup and calls ant task on test.xml inside your plugin directory.

Hope this helps.

How are you running the test.xml script?
Re: Launching Unit Tests with the Testframework for an RCP Application [message #458606 is a reply to message #458600] Thu, 23 November 2006 02:55 Go to previous messageGo to next message
Eclipse UserFriend
Aarati schrieb:
> If you follow the Eclipse testing workflow, you will notice that
> there are 2 test.xml files one at top level and other in the plugin
> directory.
>
> The top level derives the plugin name from the test.properties file ,
> copies the required test plugins to test eclipse setup and calls ant
> task on test.xml inside your plugin directory.
>
> Hope this helps.
>
> How are you running the test.xml script?

Hi,
first thanks for the answer.
I followed the article on eclipse
http://www.eclipse.org/articles/Article-PDE-Automation/autom ation.html
and the document from the test framework.

In the Article they build a new feature for the Eclipse and use the
Eclipse automated tests. First I tried that also, but it seems the
automated test expect a full Eclipse. I have an RCP application with
only a subset of eclipse features. So I changed to the eclipse test
framework.

Was that the wrong decision?

Karsten

I run the test.xml from my customTarget.xml:

<!--
============================================================ ========= -->
<!-- Steps to do after the build is done. -->
<!--
============================================================ ========= -->
<target name="postBuild">
<antcall target="gatherLogs" />
<antcall target="test" />
</target>

<!--
============================================================ ========= -->
<!-- Steps to do to test the build results -->
<!--
============================================================ ========= -->
<target name="test">
<property name="testSystem" value="${buildDirectory}/../testenv" />
<property name="testPlugin"
value="${buildDirectory}/plugins/de.aysada.stixdb.test" />
<echo message="Preparing StIXDB Testenviroment"/>
<delete dir="${testSystem}" />
<mkdir dir="${testSystem}" />
<echo message="Test Target System ${testSystem}"/>
<unzip dest="${testSystem}"

src=" ${buildDirectory}/I.TestBuild/de.aysada.stixdb.feature-TestB uild-linux.motif.x86.zip "
/>
<unzip dest="${testSystem}"

src=" ${buildDirectory}/I.TestBuild/de.aysada.stixdb.test.feature- TestBuild-linux.motif.x86.zip "/>
<copy todir="${testSystem}/stixdb">
<fileset dir="${buildDirectory}/../stix_testenv" >
<include name="**/*.*"/>
</fileset>
</copy>
<ant antfile="${testPlugin}/test.xml" target="run" dir="${testSystem}">
<property name="os" value="linux" />
<property name="ws" value="motif" />
<property name="arch" value="x86" />
</ant>

</target>
Re: Launching Unit Tests with the Testframework for an RCP Application [message #459051 is a reply to message #458606] Mon, 27 November 2006 20:37 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: aarati_k.yahoo.com

Karsten,

Hoping your issue is resolved :)

Else, You seam to be on the right track.
To debug:
In your test.xml try echo of plugin-name and see if its getting passed correctly?

Were you able to run your scripts independently, i.e without hooking it into your build?

Few ways to do that:
Unzip your eclipse.zip in <eclipse-auotmated-home>
1. java -jar startup.jar -application org.eclipse.ant.core.antRunner -buildfile <test-pluin>\test.xml -Declipse-home= <eclipse-auotmated-home>\eclipse

2. include your test plugin in test.properties, include new target for yours in test.xml, replace junit.test.jar with your jar
Remember to include all plugin need for testing under requiredplugins param for you target.Since installplugin target copied these plugins from test_*.jar to eclipse setup.
and try running runtests.bat <your-test-target>
Re: Launching Unit Tests with the Testframework for an RCP Application [message #459219 is a reply to message #459051] Wed, 29 November 2006 04:40 Go to previous messageGo to next message
Eclipse UserFriend
Aarati schrieb:
> Karsten,
>
> Hoping your issue is resolved :)
>
> Else, You seam to be on the right track.
> To debug:
> In your test.xml try echo of plugin-name and see if its getting passed correctly?
>
> Were you able to run your scripts independently, i.e without hooking it into your build?
>
> Few ways to do that:
> Unzip your eclipse.zip in <eclipse-auotmated-home>
> 1. java -jar startup.jar -application org.eclipse.ant.core.antRunner -buildfile <test-pluin>\test.xml -Declipse-home= <eclipse-auotmated-home>\eclipse
>
> 2. include your test plugin in test.properties, include new target for yours in test.xml, replace junit.test.jar with your jar
> Remember to include all plugin need for testing under requiredplugins param for you target.Since installplugin target copied these plugins from test_*.jar to eclipse setup.
> and try running runtests.bat <your-test-target>

Hi
my tests runs now on an integration server.
thanks for your support.
karsten
Re: Launching Unit Tests with the Testframework for an RCP Application [message #459269 is a reply to message #459219] Wed, 29 November 2006 13:59 Go to previous message
Eclipse UserFriend
Originally posted by: aarati_k.yahoo.com

Thats a gud news.

Just curious to know what was going wrong. I would be moving on the same track in near future and would like to avoid being in same situation as you.

Thanks
Previous Topic:eclipse update manager
Next Topic:Update Manager
Goto Forum:
  


Current Time: Mon Mar 17 05:18:58 EDT 2025

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

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

Back to the top