Any tips on using jUnit to test RCP application? [message #435432] |
Thu, 18 August 2005 08:21  |
Eclipse User |
|
|
|
Hi,
I am just about to start on an RCP application. I am fairly famililar with
jUnit -- but not with Eclipse PDE/SWT/RCP development a great deal.
I am looking for suggestions on best practices to test the *UI code*. Most
certainly, I will have my own small wrapper (or Beans if you will) on top
of RCP widgets which will be used in my application(s) and I expect to
very rarely call org.eclipse.* stuff directly from my application(s).
Any hints towards existing plugin test code will also be very helpful.
Best regards
- Babu
http://vsbabu.org/
PS: I am new to RCP; but from what I've seen, it is really nice (nothing
that you guys didn't know already :-))
|
|
|
|
|
Re: Any tips on using jUnit to test RCP application? [message #435630 is a reply to message #435623] |
Fri, 19 August 2005 09:11   |
Eclipse User |
|
|
|
> I'd say simulating button clicks etc. is what you really need here. How
> else do you want to test that the event wiring in your application is
> correct? I heard somewhere that there might be a highly expensive
> product from Rational for this problem.
Yes, and it's Rational that's pushing the idea that the wiring needs testing. Plus, it only works on Windows systems, and generally has problems with Java applications -- I'm not even sure that it works with SWT.
The point is that it is very rare that it's a problem with the wiring; things like that just tend not to break as the lifetime of a system evolves. I mean, you've put it in and tested the wiring at least once manually when it was being developed, yes? Mostly, it's just a wrapper like:
widget.addSomeSortOfListener() {
new SomeSortOfListener() {
public void someListenerMethod() {
doRealAction();
}
}
}
So instead of trying to get the exact point-and-click nature of the buttons, you can just test the doRealAction() method instead. Additionally, it makes it more robust because if the doRealAction() is used elsewhere, you've tested that individual for anything (e.g. MenuItems) that can call it directly.
To be honest, the main problem is not the wiring but instead it is the Thread access -- there's a bunch of things that you can/can't do in the main SWT processing thread (particularly changes during a modification event). (see http://help.eclipse.org/help30/topic/org.eclipse.platform.do c.isv/guide/swt_threading.htm for more info)
|
|
|
|
|
|
Re: Any tips on using jUnit to test RCP application? [message #435663 is a reply to message #435630] |
Mon, 22 August 2005 05:22  |
Eclipse User |
|
|
|
Originally posted by: joerg.von.frantzius.artnology.nospam.com
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Alex Blewitt schrieb:
<blockquote
cite="mid480676.1124457122548.JavaMail.root@cp1.javalobby.org"
type="cite">
<blockquote type="cite">
<pre wrap="">I'd say simulating button clicks etc. is what you really need here. How
else do you want to test that the event wiring in your application is
correct? I heard somewhere that there might be a highly expensive
product from Rational for this problem.
</pre>
</blockquote>
<pre wrap=""><!---->
Yes, and it's Rational that's pushing the idea that the wiring needs testing. Plus, it only works on Windows systems, and generally has problems with Java applications -- I'm not even sure that it works with SWT.
</pre>
</blockquote>
Right, I don't know neither. I'd still like to test the wiring, even if
that wish astoundingly conforms to Rational marketing ;)<br>
I've got an RCP application here that has a lot of state to keep in the
UI. For one there is things like enabling and disabling actions based
on selections, e.g. a delete-button that can cause a list and thus its
selection to become empty, which in turn disables actions, and then
there is stuff like two windows with the selection in one window
causing the second window to change display and action enablement. <br>
<br>
There is enough that can go wrong in the UI, so I really want to have
my handful of use-cases being clicked through the application,
hopefully without having to train any monkeys, or me becoming the click
monkey.<br>
<br>
I just see that this is not the thread that had Abbot mentioned in it;
somewhere someone posted about experiences with that and it sounded
promising although not ready for production use. Digging for it I just
found some posts in eclipse.tools.hyades saying that IBM had extended
Abbot and wanted to make that open source.<br>
</body>
</html>
|
|
|
Powered by
FUDForum. Page generated in 0.15885 seconds