Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Test and Performance Tools Platform (TPTP) » [AGR] ClassCastException in Verification Hook
[AGR] ClassCastException in Verification Hook [message #94299] Wed, 28 March 2007 11:34 Go to next message
Eclipse UserFriend
Originally posted by: Christopher.Schick.gmx.de

Guys,

I'm using the AGR to record a couple of user interactions with a custom
plug-in and test the result through Verification Hooks.

Recording works fine as well as creation of the Verification Hook code
skeleton.
However, inside the Hook method I want to access the properties of a
selected view. To achieve this I need to typecast arg0 (IViewPart) to the
type of the selected view (e.g. CustomView).

As soon as I try to cast arg0 to one of our custom view classes, I get a
ClassCastException.

Funny enough, when writing the class name to the console via
"System.out.println(arg0.getClass());"

it returns: "class com.voiceobjects.CustomView"

Now when trying to do the cast it fails: "com.voiceobjects.CustomView CV =
(CustomView)arg0;"

Any insight ?

Thanks
-Chris

P.S.: Type hierarchy for CustomView is WorkbenchPart => ViewPart => VOView
=> CustomView
Re: [AGR] ClassCastException in Verification Hook [message #94346 is a reply to message #94299] Wed, 28 March 2007 14:29 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 404
Registered: July 2009
Senior Member
Hi Chris,

Does the plug-in containing the test suite declare a dependency (in
plugin.xml) on the plug-in that contains the CustomView code?

I suspect something is going wrong with the class loader. The class loader
for verification hooks will first try to resolve a class using the
dependencies of the plug-ins that the test suite resides in. If that fails,
then it will try to locate a class under the output folder of the plug-in or
the classpath entries of the plug-in.

It will help if you provide more details about the project structure that
contains the test suite.

Thanks,
Ali Mehregani


"Chris" <Christopher.Schick@gmx.de> wrote in message
news:eudjs6$o9c$1@utils.eclipse.org...
> Guys,
>
> I'm using the AGR to record a couple of user interactions with a custom
> plug-in and test the result through Verification Hooks.
>
> Recording works fine as well as creation of the Verification Hook code
> skeleton.
> However, inside the Hook method I want to access the properties of a
> selected view. To achieve this I need to typecast arg0 (IViewPart) to the
> type of the selected view (e.g. CustomView).
>
> As soon as I try to cast arg0 to one of our custom view classes, I get a
> ClassCastException.
>
> Funny enough, when writing the class name to the console via
> "System.out.println(arg0.getClass());"
>
> it returns: "class com.voiceobjects.CustomView"
>
> Now when trying to do the cast it fails: "com.voiceobjects.CustomView CV =
> (CustomView)arg0;"
>
> Any insight ?
>
> Thanks
> -Chris
>
> P.S.: Type hierarchy for CustomView is WorkbenchPart => ViewPart => VOView
> => CustomView
>
>
Re: [AGR] ClassCastException in Verification Hook [message #94376 is a reply to message #94346] Wed, 28 March 2007 16:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Christopher.Schick.gmx.de

Hi Ali,

Actually adding the plug-in to the depency list did the trick. Many thanks
for your help.

Imp question: Is there any documentation about the use of classloaders in
the test execution suites ?

I don't want to face similar issues when automating the tests.

Thanks
-Chris
Re: [AGR] ClassCastException in Verification Hook [message #95125 is a reply to message #94376] Mon, 09 April 2007 13:59 Go to previous message
No real name is currently offline No real nameFriend
Messages: 404
Registered: July 2009
Senior Member
There is no documentation available on the classloader. If you're
interested to dig inside the code, then extract
test/org.eclipse.tptp.test.auto.gui and take a look at
org.eclipse.tptp.test.auto.gui.internal.core.VerifHookClassL oader

"Chris" <Christopher.Schick@gmx.de> wrote in message
news:eue5sf$vnq$1@build.eclipse.org...
> Hi Ali,
>
> Actually adding the plug-in to the depency list did the trick. Many thanks
> for your help.
>
> Imp question: Is there any documentation about the use of classloaders in
> the test execution suites ?
>
> I don't want to face similar issues when automating the tests.
>
> Thanks
> -Chris
>
>
Previous Topic:Junit headless plugin testing code coverage?
Next Topic:java.lang.NoClassDefFoundError: <my main class>
Goto Forum:
  


Current Time: Thu Apr 25 19:19:44 GMT 2024

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

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

Back to the top