Automated RCP Testing

WindowTester allows you to easily create and run unit tests for every GUI they build. It can also be used to generate system level tests.

Moderators: gnebling, Eric Clayberg, Dan Rubel, keertip, Phil Quitslund

Automated RCP Testing

Postby Otisler » Wed Mar 28, 2007 6:06 am

Is there any documentation or are there any sample projects of RCP automated testing? I've ran the SWT sample test suite that was provided on the instantiations web site, but I can't seem to get it working for an RCP app. Does anybody have any experience with this?

Thanks
Otisler
 
Posts: 28
Joined: Tue Mar 27, 2007 1:24 pm
Location: Vernon Hills IL

Postby Phil Quitslund » Fri Mar 30, 2007 8:11 am

We're currently building a set of simple examples and hope to make them public soon.

In the meantime, you mean you tried the sample found here?:

http://downloads.instantiations.com/Win ... l#cmd_line

This is a good start.

To specify an RCP application rather than the Eclipse product, add the following line to the java task in the eclipse-test target within library.xml:

<arg line="-testApplication com.acme.ui.application"/>

where "com.acme.ui.application" is replaced by your application's id.

More soon!
--
Phil Quitslund
Software Engineer
Google, Inc.
Phil Quitslund
Moderator
 
Posts: 491
Joined: Fri Apr 28, 2006 6:26 am

Postby Otisler » Fri Mar 30, 2007 9:40 am

Hello, I've actually looked at that article and it has helped me in getting started, and I was able to run your example, <com.windowtester.swt.sample>; however, it is a little different running a stand-alone RCP app. I had some success doing this, however, I'm still seeing some problems.
All of the plugins which are required to run the JUnit tests (jdt, pde, windowTester, etc) contribute functionality to my RCP which I don't want in there. So when I'm testing my RCP app, I can get the tests to run, but its not running on my clean build, the plugins add extra stuff to it.
Is there a way to remove these and have only my RCP stuff in there??

Thanks
Otisler
 
Posts: 28
Joined: Tue Mar 27, 2007 1:24 pm
Location: Vernon Hills IL

Postby Otisler » Fri Mar 30, 2007 10:03 am

Also, when I added that -testApplication arg to the library.xml file like so:

<target name="eclipse-test">
<tstamp>
<format property="TIMENOW" pattern="HHmmssSSSS"/>
</tstamp>

<property name="vmargs" value=""/>
<property name="launcher" value="org.eclipse.core.launcher.Main"/>
<property name="formatter" value="org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter"/>
<property name="extraVMargs" value=""/>
<property name="plugin-path" value="" />
<property name="timeout" value="3600000" />
<arg line="-testApplication zbiide.application"/>
<!--run one of the following targets depending on the setting of the Ant property, performance-->
<antcall target="junit" />
<antcall target="performance" />
</target>


I get the following error:

eclipse-test:

BUILD FAILED
D:\AutoTesting\eclipse-testing\test-wt.xml:80: The following error occurred whil
e executing this line:
D:\AutoTesting\eclipse-testing\test-wt.xml:74: The following error occurred whil
e executing this line:
D:\AutoTesting\eclipse-testing\test-wt.xml:57: The following error occurred whil
e executing this line:
D:\AutoTesting\eclipse-testing\test-eclipse\eclipse\plugins\com.windowtester.swt
.samples\test.xml:26: The following error occurred while executing this line:
D:\AutoTesting\eclipse-testing\test-eclipse\eclipse\plugins\org.eclipse.test\lib
rary.xml:17: The following error occurred while executing this line:
D:\AutoTesting\eclipse-testing\test-eclipse\eclipse\plugins\org.eclipse.test\lib
rary.xml:34: Could not create task or type of type: arg.

Ant could not find the task or a class this task relies upon.

This is common and has a number of causes; the usual
solutions are to read the manual pages then download and
install needed JAR files, or fix the build file:
- You have misspelt 'arg'.
Fix: check your spelling.
- The task needs an external JAR file to execute
and this is not found at the right place in the classpath.
Fix: check the documentation for dependencies.
Fix: declare the task.
- The task is an Ant optional task and the JAR file and/or libraries
implementing the functionality were not found at the time you
yourself built your installation of Ant from the Ant sources.
Fix: Look in the ANT_HOME/lib for the 'ant-' JAR corresponding to the
task and make sure it contains more than merely a META-INF/MANIFEST.MF.
If all it contains is the manifest, then rebuild Ant with the needed
libraries present in ${ant.home}/lib/optional/ , or alternatively,
download a pre-built release version from apache.org
- The build file was written for a later version of Ant
Fix: upgrade to at least the latest release version of Ant
- The task is not an Ant core or optional task
and needs to be declared using <taskdef>.
- You are attempting to use a task defined using
<presetdef> or <macrodef> but have spelt wrong or not
defined it at the point of use

Remember that for JAR files to be visible to Ant tasks implemented
in ANT_HOME/lib, the files must be in the same directory or on the
classpath

Please neither file bug reports on this problem, nor email the
Ant mailing lists, until all of these causes have been explored,
as this is not an Ant bug.

Thanks
Otisler
 
Posts: 28
Joined: Tue Mar 27, 2007 1:24 pm
Location: Vernon Hills IL

Procedure for running tests

Postby blacksmith » Fri Mar 30, 2007 10:13 am

This is a high level procedure the sample code will follow.
  • Download Eclipse
  • Download eclipse Automated Test framework
  • Install Eclipse
  • Install automated testing framework
  • Download product
  • Install product
  • Run tests
  • Format output
  • Display output


These steps will all be controlled by and and can be optional
Mark Russell
Build Master
Instantiations, Inc.
http://www.instantiations.com
blacksmith
Moderator
 
Posts: 19
Joined: Fri Apr 28, 2006 6:57 am
Location: Portersville, PA USA

Postby Otisler » Mon Apr 02, 2007 7:06 am

Hi, I've gotten a little closer to getting the automated testing to work. I was playing around with it a little more and I'm having another problem related to RCP Testing.


The plugins necessary to run the JUnit plugin tests (jdt, pde, ant, winTester, etc) are contributing views, perspectives, and other functionality not present in my original RCP. I can get around this to a certain extent. Right now, before running the tests on my RCP, I set up the system by going to my RCP's default perspective and making sure it starts off in the proper state. However, I still can't have these PDE's external functionality present during my testing because then, I am not testing the RCP I plan on delivering to the customers, I am testing a hybrid of my RCP with some external Eclipse-type plugins.

Now, my question is; Is there a way to isolate my RCP such that only it is contributing to the application framework? To somehow separate my RCP from the testing Platform?

Thanks again

Ovi Tisler
Zebra Technologies
Otisler
 
Posts: 28
Joined: Tue Mar 27, 2007 1:24 pm
Location: Vernon Hills IL

Postby gnebling » Thu Aug 02, 2007 12:19 pm

We've put together an example for running WindowTester tests on a RCP Application from Ant. Please see this page for more information on where to download and how to run the script:

http://downloads.instantiations.com/Win ... ample.html

Please give it a try and let us know how your testing goes.
gnebling
Moderator
 
Posts: 243
Joined: Tue Aug 22, 2006 7:49 am

Versions

Postby Otisler » Tue Aug 14, 2007 10:00 am

Which versions of WindowTester is this RCP testing compatible with?
Do you need the WindowTesterRuntime to be able to run these tests?

I have 2.0.0 and there is no Runtime available for that version, so when it downloads the 2.2.1 version, I am not licensed for that version and get that "License not set up properly error"

thanks
Ovi
Otisler
 
Posts: 28
Joined: Tue Mar 27, 2007 1:24 pm
Location: Vernon Hills IL

Postby gnebling » Tue Aug 14, 2007 10:09 am

The sample works with WT 2.2.1. You need to activate v2.2.1 on your machine.
gnebling
Moderator
 
Posts: 243
Joined: Tue Aug 22, 2006 7:49 am

Plugin dependencies

Postby Otisler » Tue Aug 14, 2007 1:35 pm

Hi, I'm working on the RCP test from ant example and I'm trying to use the example as a template for my own testing. My Test plugin depends on other plugins to perform the tests.

Where can I link in those dependencies to my test Plugin?
Otisler
 
Posts: 28
Joined: Tue Mar 27, 2007 1:24 pm
Location: Vernon Hills IL

Postby gnebling » Tue Aug 14, 2007 2:54 pm

If we understand your question you need to do 2 things:

Make sure your plug-in is included in your test plug-in MANIFEST.
Make sure your plug-in is deployed to your test environment for execution of the test.

If that's not what you're looking for, please elaborate.
gnebling
Moderator
 
Posts: 243
Joined: Tue Aug 22, 2006 7:49 am

rcp testing

Postby Otisler » Wed Aug 15, 2007 5:27 am

I'm sorry, I was pretty vague, let me elaborate.

I have two projects in eclipse -
one is an RCP app called ZbiIde
the other is a plugin, it is my test suite written using windowTester

I build and export the application, ZbiIde, and (according to the example), place it in the application directory. This works fine, it is launchable and it also gets launched from the runTests.bat call

Next I export the testing plugin as a "Deployable plug-in and Fragments" in eclipse, from which i get a jar file. I place that jar file in the apptest directory.

I modify all the ant scripts to properly launch my program. It works and goes through the test suite just fine, however, ever test fails because it can't find all the classes.
This is one of the errors:

org/eclipse/debug/core/DebugPlugin

java.lang.NoClassDefFoundError: org/eclipse/debug/core/DebugPlugin at com.zbiide.autotesting.test.CommonFunctionality.tearDown(CommonFunctionality.java:124) at junit.extensions.UITestCaseCommon.access$101(UITestCaseCommon.java:26) at junit.extensions.UITestCaseCommon$1.run(UITestCaseCommon.java:140) at junit.extensions.core.SequenceRunner$1.run(SequenceRunner.java:69)



Now in my com.zbiide.autotesting plugin I have a list of other plugins I depend on to run the tests, the org.eclipse.debug.core.DebugPlugin being one of them. But, I don't get that jar when I export my testing Plugin. I do have it in the ZbiIde RCP application though.

Should I pull those jars local and access them like that before I export the Test plugin?
Do I have to reference those jars from my application instead of from the eclipse/plugins directory?
Am I exporting my test Plugin incorrectly?

I hope that all makes sense.
Thanks
Otisler
 
Posts: 28
Joined: Tue Mar 27, 2007 1:24 pm
Location: Vernon Hills IL

Postby Dan Rubel » Wed Aug 15, 2007 7:26 am

Can you successfully launch the com.zbiide.autotesting plugin test(s) using right-click "Run As > JUnit Plug-in Test" from within your development environment? Do they execute properly? I'm trying to break down the process into smaller steps to better understand whether the problem is with test configuration or test export.
Dan Rubel
Moderator
 
Posts: 27
Joined: Thu Oct 30, 2003 9:13 am

Postby Otisler » Wed Aug 15, 2007 7:34 am

yes, everything works fine within eclipse
Otisler
 
Posts: 28
Joined: Tue Mar 27, 2007 1:24 pm
Location: Vernon Hills IL

exporting

Postby Otisler » Wed Aug 15, 2007 12:00 pm

I think I may be exporting the test plugin incorrectly. How are you supposed to export it?

If i export it as a "Deployable plugins and fragments" and include the manifest file, it says that it can't find the plugin.
If I don't include the manifest file and only include the plugin.xml, the tests will run, but I will get those classdefnotfound errors because the dependencies are not listed in the manifest.

If I include both manifest and plugin.xml, it won;t work either.
Can you post an example on how to export the test plugin for ant RCP testing? Thanks
Otisler
 
Posts: 28
Joined: Tue Mar 27, 2007 1:24 pm
Location: Vernon Hills IL

Next

Return to Window Tester

Who is online

Users browsing this forum: No registered users and 1 guest