Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » uitest throws ClassCastException
uitest throws ClassCastException [message #331343] Tue, 02 September 2008 16:13 Go to next message
Frank Kurzawa is currently offline Frank KurzawaFriend
Messages: 7
Registered: July 2009
Junior Member
Hello all,

I've created a TestSuite to be run by uitest in the Eclipse Test
Framework. The TestSuite is simply a collection of my plugin tests. When I
run the tests, I receive the following (abbreviated) stack trace:
<error message="junit.framework.TestSuite cannot be cast to
junit.framework.Test" type="java.lang.ClassCastException"> at
org.eclipse.test.EclipseTestRunner.getTest(EclipseTestRunner .java:265)
at
org.eclipse.test.EclipseTestRunner.&lt;init&gt;(Ecli pseTestRunner.java:220)
at
org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.jav a:204)
at
org.eclipse.test.UITestApplication$3.run(UITestApplication.j ava:195)

This is very confusing to me junit.framework.TestSuite implments
junit.framework.Test.

There is nothing special about my TestSuite. I simply instantiate it and
then suite.addTest( TestCase ) for several different junit tests. Finally,
my suite() method returns the suite as a Test.

My invocation of uitest is similarly plain vanilla:
<ant target="ui-test" antfile="${library-file}" dir="${eclipse-home}">
<property name="os" value="linux"/>
<property name="ws" value="gtk"/>
<property name="arch" value="${basearch}"/>
<property name="data-dir" value="${eclipse-home}/junit-workspace
-clean" />
<property name="plugin-name" value="com.amd.ngeda.core.test" />
<property name="classname" value="com.amd.ngeda.AllTests" />
<property name="extraVMargs"
value="-Demma.coverage.out.file=${coverageDirectory}/coverage.emma
-Djava.ext.dirs=${ext.dir} -Dosgi.parentClassloader=ext" />
</ant>


I saw this identical question posted to the newsgroup in June
( http://dev.eclipse.org/newslists/news.eclipse.platform/msg76 042.html) so
apparently others have experienced this problem, but unfortunately there
was no response.

Thanks in advance,
Frank
Re: uitest throws ClassCastException [message #331405 is a reply to message #331343] Thu, 04 September 2008 20:26 Go to previous message
Frank Kurzawa is currently offline Frank KurzawaFriend
Messages: 7
Registered: July 2009
Junior Member
FWIW, I found the cause of this problem, just in case anyone else runs
into it. My plugin has a dependency on JUnit4 and so JUnit4 was attempting
to run (and cast) this suite. Presumably the problem arose since JUnit4
uses annotations. The same suite had no problems when run under JUnit3.

Regards,
Frank
Previous Topic:Menu extensions
Next Topic:How to use EditionSelectionDialog
Goto Forum:
  


Current Time: Sun Jun 30 00:28:13 GMT 2024

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

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

Back to the top