Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Run As JUnit Plug-in Test
Run As JUnit Plug-in Test [message #328308] Wed, 21 May 2008 09:58 Go to next message
Manuel Selva is currently offline Manuel SelvaFriend
Messages: 189
Registered: July 2009
Location: Grenoble, France
Senior Member
Hi,

I successfully wrote my first Test Plug-in. All works fine but I noticed a
strange thing (Certainly a glitch from side ...).

When an Error is logged into the Error log (associated to the workspace of
my JUnit Plug-in Test launchn configuration) PDE / JUnit don't tell me of
such an error. All my tests succeeded so I though thta all worked fine but
.... I had an error in the error log but I just noticed it now ... (by
chance !!!)

Is there any way to tell PDE/JUnit to inform the user each time an Error
is logged into error log the same way test failure are presented to the
user ?

Thanks

Manu
http://manuel.selva.wordpress.com


Re: Run As JUnit Plug-in Test [message #328312 is a reply to message #328308] Wed, 21 May 2008 12:23 Go to previous messageGo to next message
Marco Maccaferri is currently offline Marco MaccaferriFriend
Messages: 147
Registered: July 2009
Senior Member
On 21/05/2008 11:58 Manuel Selva ha scritto:

> Is there any way to tell PDE/JUnit to inform the user each time an Error
> is logged into error log the same way test failure are presented to the
> user ?

AFAIK, there is no such way.

However, the problem is that you are testing a method that catches and
log that error. You should test the method that actually throws the
exception so it can be catched by JUnit and handled like a failure.

Hope this helps.

Regards,
Marco.
Re: Run As JUnit Plug-in Test [message #328317 is a reply to message #328312] Wed, 21 May 2008 13:23 Go to previous messageGo to next message
Manuel Selva is currently offline Manuel SelvaFriend
Messages: 189
Registered: July 2009
Location: Grenoble, France
Senior Member
Hi Marco,

Thanks for your answer. The problem is that the method throwing the
exception is an Eclipse mathod and not my method. More accurately it's the
IWorkbenchPage.showView method throwing a PartInitException (because I
forgot to set the AllowMutiple field in my extension description) ...

Manu


Re: Run As JUnit Plug-in Test [message #328321 is a reply to message #328317] Wed, 21 May 2008 14:34 Go to previous messageGo to next message
Marco Maccaferri is currently offline Marco MaccaferriFriend
Messages: 147
Registered: July 2009
Senior Member
On 21/05/2008 15:23 Manuel Selva ha scritto:

> Thanks for your answer. The problem is that the method throwing the
> exception is an Eclipse mathod and not my method. More accurately it's the
> IWorkbenchPage.showView method throwing a PartInitException (because I
> forgot to set the AllowMutiple field in my extension description) ...

You can test that method too, something like:

testCanOpenMultipleViews() {
activePage.showView("primary", "secondary", VIEW_ACTIVATE);
}


Or, if showView is called from a more complex method, you can move the
commands to a method that passes the exceptions upstream. For example,
if it is contained in a Action.run method that catches the exception and
display a dialog to the user, move the code inside the try/catch block
to a method with the throws clause and test that method. The run method
simply calls the new method inside the try/catch block.

Regards,
Marco.
Re: Run As JUnit Plug-in Test [message #328335 is a reply to message #328321] Wed, 21 May 2008 19:41 Go to previous message
Manuel Selva is currently offline Manuel SelvaFriend
Messages: 189
Registered: July 2009
Location: Grenoble, France
Senior Member
Thanks for your suggestions Marcco.

Manu


Previous Topic:workbench hangs after first execution
Next Topic:Persisting Detached Views across Perspectives
Goto Forum:
  


Current Time: Wed Jul 17 18:48:35 GMT 2024

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

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

Back to the top