|
|
Re: Any tips on using jUnit to test RCP application? [message #435623 is a reply to message #435598] |
Fri, 19 August 2005 08:29 |
Eclipse User |
|
|
|
Originally posted by: joerg.von.frantzius.artnology.nospam.com
Alex Blewitt schrieb:
>I think the best practices are not to test the UI code directly (e.g. don't try to simulate clicking on a button) but instead test the code that the UI components should call. For example,
>
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.
>if you want to find out whether the right properties are being displayed in a PropertiesView, test the actual IPropertySource object directly instead of the PropertiesView contents. It's got a fairly simple interface (as have most UI hooks in Eclipse) so it shouldn't be difficult to test them separately.
>
>You can also write/run JUnit tests in a run-time workspace if you need extra features (e.g. access to the Workspace stuff) in your tests as well.
>
>
|
|
|
Re: Any tips on using jUnit to test RCP application? [message #435630 is a reply to message #435623] |
Fri, 19 August 2005 13:11 |
Alex Blewitt Messages: 946 Registered: July 2009 |
Senior Member |
|
|
> 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 09: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.03835 seconds