Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Problems running headless junit4 tests with eclipse 3.4.2
Problems running headless junit4 tests with eclipse 3.4.2 [message #505397] Wed, 30 December 2009 06:42 Go to next message
Fabian Baboschi is currently offline Fabian Baboschi
Messages: 40
Registered: December 2009
Member
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.

Thanks.
Re: Problems running headless junit4 tests with eclipse 3.4.2 [message #505476 is a reply to message #505397] Thu, 31 December 2009 00:57 Go to previous messageGo to next message
John Reysa is currently offline John Reysa
Messages: 21
Registered: July 2009
Junior Member
Fabian Baboschi wrote:
> 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.
>
> Thanks.
Denis Golovin found an answer to a similar problem that worked for me ...
He said: "If you Eclipse Test Framework installed, than
org.eclipse.ant.optional.junit_*.jar should be deleted to fix this
problem. I had the same problem which was even worst, because this
happened for me sometimes, even if previous build was successful an
nothing changed for next one."
....
My bundle was in the CDT set of plugins. Once I removed it from my
launch configuration (and from my product plugin definition), it worked.
Re: Problems running headless junit4 tests with eclipse 3.4.2 [message #505496 is a reply to message #505397] Thu, 31 December 2009 01:31 Go to previous messageGo to next message
Fabian Baboschi is currently offline Fabian Baboschi
Messages: 40
Registered: December 2009
Member
Indeed, I had that plugin in my product.
Deleting the org.eclipse.ant.optional.junit_*.jar fragment made the failing builds work.
Thanks.
Re: Problems running headless junit4 tests with eclipse 3.4.2 [message #505718 is a reply to message #505496] Mon, 04 January 2010 11:26 Go to previous message
Ketan Padegaonkar is currently offline Ketan Padegaonkar
Messages: 873
Registered: July 2009
Senior Member
That's great! I've updated the Troubleshooting[1] guide with this
information so it's easier to find and lookup.

http://wiki.eclipse.org/SWTBot/Troubleshooting#Exception_in_ thread_.22WorkbenchTestable

-- Ketan

On 12/30/09 10:31 PM, Fabian Baboschi wrote:
> Indeed, I had that plugin in my product.
> Deleting the org.eclipse.ant.optional.junit_*.jar fragment made the
> failing builds work.
> Thanks.
Previous Topic:How to deselect/unselect a tree item
Next Topic:Launching SWTBot test through EclEmma
Goto Forum:
  


Current Time: Thu Aug 28 11:18:24 EDT 2014

Powered by FUDForum. Page generated in 0.01849 seconds