Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Eclipse Automated Testing Framework
Eclipse Automated Testing Framework [message #100911] Fri, 03 October 2003 06:24 Go to next message
Eclipse UserFriend
Originally posted by: rsudra.hotmail.com

Dear all,

I have been taking a look at how Eclipse (and our own plugins) can be tested
using the automated testing framework. I have been looking at some of the
test code as I want to see how the framework is used to test package
methods, and how it achieves this considering that the test plugin and the
target plugin are loaded using separate classloaders.(and therefore no
visibility). I haven't stumbled on any examples yet, could anyone point some
out?

I have been able to solve this problem using reflection but I wanted to see
how the eclipse engineers do it, or do they just test only public methods.
Bear in mind that I do not want to test private methods, just public and
package ones.

Thanks
Raj
Re: Eclipse Automated Testing Framework [message #101138 is a reply to message #100911] Fri, 03 October 2003 16:04 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: John_Arthorne.oti.com_

We generally only test public classes and methods. However, you can
have multiple plugins that define the same package to access
package-private members across plugins. In rare cases we'll embed a
public "back door" method in a non-API package that exposes certain data
structures for testing.
--

Rajeev Sudra wrote:
> Dear all,
>
> I have been taking a look at how Eclipse (and our own plugins) can be tested
> using the automated testing framework. I have been looking at some of the
> test code as I want to see how the framework is used to test package
> methods, and how it achieves this considering that the test plugin and the
> target plugin are loaded using separate classloaders.(and therefore no
> visibility). I haven't stumbled on any examples yet, could anyone point some
> out?
>
> I have been able to solve this problem using reflection but I wanted to see
> how the eclipse engineers do it, or do they just test only public methods.
> Bear in mind that I do not want to test private methods, just public and
> package ones.
>
> Thanks
> Raj
>
>
Re: Eclipse Automated Testing Framework [message #101352 is a reply to message #101138] Sat, 04 October 2003 20:26 Go to previous messageGo to next message
Eclipse UserFriend
On Fri, 03 Oct 2003 16:04:04 -0400, John Arthorne <John_Arthorne@oti.com_>
wrote:

> We generally only test public classes and methods. However, you can have
> multiple plugins that define the same package to access package-private
> members across plugins. In rare cases we'll embed a public "back door"
> method in a non-API package that exposes certain data structures for
> testing.

Accessing cross-plugins package-private members was broken in 2.1.1.
It seems to work now in 3.0 M3, (I just did a quick check).
So I would recommend an ugly kludge in 2.1.1, i.e. to have a
method like :

public static void makeAccessible( Class c ) {
Field[] lf = c.getDeclaredFields();
for( int i = 0; i < lf.length; i++ )
if( (lf[ i ].getModifiers() & Modifier.PUBLIC) != 0 )
lf[ i ].setAccessible( true );
Method[] lm = c.getDeclaredMethods();
for( int i = 0; i < lf.length; i++ )
if( (lm[ i ].getModifiers() & Modifier.PUBLIC) != 0 )
lm[ i ].setAccessible( true );
}

(Of course in your TEST plugin, not in release code ;-)
And to call it from your test cases.
When you will migrate to 3.0 just remove this method and its references.

--
Steve
Re: Eclipse Automated Testing Framework [message #103183 is a reply to message #101352] Fri, 10 October 2003 15:42 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: John_Arthorne.oti.com_

Well, I actually misanswered. It is possible to do this across Eclipse
projects in your workspace, but since each Eclipse plugin has its own
classloader, they cannot share package visible members.
--

Eric Estievenart wrote:
>> Accessing cross-plugins package-private members was broken in 2.1.1.
>> It seems to work now in 3.0 M3, (I just did a quick check).
>
>
> I mistested. M3 still have the issue. There is a bug logged:
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=37647
>
Re: Eclipse Automated Testing Framework [message #103356 is a reply to message #103183] Sat, 11 October 2003 23:27 Go to previous message
Eclipse UserFriend
I misunderstood what you misanswered ;-)

Anyway, I fully agree with the fact that plugins must have
separate class loaders, but it would be great
that for testing purpose only we could bypass this scheme.

I logged an enhancement request :
https://bugs.eclipse.org/bugs/show_bug.cgi?id=44709
Feel free to vote ;-)

--
Steve
Previous Topic:How do I change default workspace location?
Next Topic:how to enable assertions
Goto Forum:
  


Current Time: Sun May 11 14:27:05 EDT 2025

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

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

Back to the top