Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-user] Running eclipse plugin test that depends on an Eclipse library

probably org.eclipse.jdt.junit or one of its dependencies is missing in the eclipse instance used to execute the test.

You can add runtime-only dependencies of tests using e.g. 
 
<plugin>
  <groupId>org.eclipse.tycho</groupId>
  <artifactId>tycho-surefire-plugin</artifactId>
  <configuration>
    <dependencies>
      <dependency>
        <type>p2-installable-unit</type>
        <artifactId>org.eclipse.jdt.junit</artifactId>
      </dependency>
    </dependencies>
  </configuration>
</plugin>

In general, tycho cannot know about any dependencies you require from a project being compiled during test execution.

Regards
Jan





From: tycho-user-bounces@xxxxxxxxxxx [mailto:tycho-user-bounces@xxxxxxxxxxx] On Behalf Of iulian dragos
Sent: Mittwoch, 6. Juli 2011 15:02
To: Tycho user list
Subject: [tycho-user] Running eclipse plugin test that depends on an Eclipse library

Hello,

In one of our testing scenarios, we need to test our plugin (for the Scala language) on a project that depends on JUnit. The test fails in Tycho because JUnit is not on the project's classpath, but succeeds in the Eclipse test runner. 

Here's my setup:

 - tycho builds successfully both my plugin and the test fragment
 - it prepares an Eclipse instance populated with the right dependencies and runs my test class
 - my test class copies an existing project recursively into the new/empty workspace
 - my test compiles the test project, and fails because JUnit is not on the classpath

The .classpath looks correct:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.scala-ide.sdt.launching.SCALA_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
        <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> 
<classpathentry kind="output" path="bin"/>
</classpath>

(the SCALA_CONTAINER is correctly found).

If I change the junit dependency to point directly to a jar file (instead of the classpath container JUNIT_CONTAINER), the test passes.

What am I doing wrong?

thanks,
iulian

-- 
« Je déteste la montagne, ça cache le paysage »
Alphonse Allais


Back to the top