| 
| uitest throws ClassCastException [message #331343] | Tue, 02 September 2008 12:13  |  | 
| Eclipse User  |  |  |  |  | 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.<init>(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 16:26  |  | 
| Eclipse User  |  |  |  |  | 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
 |  |  |  | 
Powered by 
FUDForum. Page generated in 0.02113 seconds