|Problems running headless junit4 tests with eclipse 3.4.2 [message #505397]
||Wed, 30 December 2009 06:42
| Fabian Baboschi
Registered: December 2009
I have a feature based eclipse product that needs to include the org.eclipse.jdt feature for eclipse 3.4.2. This feature includes both junit-3.8.2 and junit4-4.3.1.|
I'm trying to run the headless tests for this product by adding them as a separate feature to the product.
When I run the tests, the results are one of the following (I don't know why this happens and it's random with each new product build):
1. They fail with this error:
[java] Exception in thread "WorkbenchTestable" java.lang.ClassCastException: org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultF ormatter
[java] at org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner .run(EclipseTestRunner.java:331)
[java] at org.eclipse.swtbot.eclipse.junit4.headless.EclipseTestRunner .run(EclipseTestRunner.java:208)
[java] at org.eclipse.swtbot.eclipse.junit4.headless.UITestApplication .runTests(UITestApplication.java:115)
[java] at org.eclipse.ui.internal.testing.WorkbenchTestable$1.run(Work benchTestable.java:68)
[java] at java.lang.Thread.run(Thread.java:595)
2. The tests run ok.
The thing that puzzles me is that sometimes the tests are run.
Is there any way that I can ensure the fact that XMLJUnitResultFormatter is taken from the junit4 plugin and not from the junit3 one?
I'm using version 2.0.0-433-dev-e34 of all swtbot features.
I know only one version of junit should be used at a time so:
I tried removing junit-3.8.2 from the final build, but the build just crashes silently after running a few tests.
Now I'm trying to run the tests from eclipse with junit-3.8.2 by removing the junit-4.3.1 plugin from the Launch configuration. But, in the Launch configuration Validation (I use "Launch with plugins selected below only"), I get an error saying that junit.framework version 4.3.1 is required by the swtbot.finders, swtbot.eclipse.ui and swtbot.junit4_x and of course, running the tests fails because the bundle that runs the tests can't be loaded due to this dependency.
Can I run the tests using only junit-3.8.2 somehow? The swtbot plugins are the only ones that need junit4.