views:

474

answers:

3

I want to add a view to a perspective without having access to the source code of the perspective. Is this possible?

Is there a good tutorial for plug-in development using TDD?

[edit] I think I have a good starting point with TDDing in plugin development Automating unit tests (junit) for Eclipse Plugin development

[edit 02/17/09] I was able to download the source for the plug-in. I'm just probably going to fork it.

+1  A: 

You might want to take a look at the org.eclipse.ui.perspectiveExtensions Extension Point.

And here is a nice article concerning Perspectives: Using Perspectives in the Eclipse UI

Sorry, can't help you with the TDD part of your question.

Stefan Schmidt
+1  A: 

Testing GUIs is a PAIN! And the pain grows exponentially with the complexity of the gui design. Your best bet is to keep the business logic separate from the GUI as much as possible with the MVC pattern and when testing the gui, hook the GUI up to a "mock" application.

See Object Mentor's paper, the Humble Dialog Box

OTisler
@OTilserThanks. I'm quite familar with humble view. I myself prefer a presenter first implementation. gutzofter
Gutzofter
You're welcome. We started down the path of Humble dialog on a recent project and started getting lazy. We ended up doing a GUI record/playback for a lot of our tests. Needless to say, it really sucks. As long as you don't go down that route, you'll save yourself some gray hairs and twitching eyes
OTisler
The problem I see with a humble view is that the view holds a reference to the presenter/controller
Gutzofter
A: 

If your goal is to simply add the view to a perspective in your own Eclipse instance, you can just open it when being in that perspective, and choose Window -> Save Perspective As...

For unit testing plug-ins, you can basically test them using normal JUnit tests, which you run as JUnit plug-in tests instead of normal JUnit tests in Eclipse. For GUI testing you could check out SWTBot.

Fabian Steeg