Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-dev] Error when using AbstractTychoMojoTestCase

Hi Tobias,

thanks for your response. I have seen that other plugins (e.g. the compiler plugin) does also have unit tests which uses the AbstractTychoMojoTestCase and so I thought it might be possible for that plugin as well.
Anyway, I found an IT test which does test the repository mojo and extended that test with the new functionality ( The patch might not get in anyway because Jan already submitted a patch for that issue.

You are right it's better for unit tests to initializing the mojo in the test directly, but not always that's that easy to "feed" the directly initialized mojo with all the required parameters, maven projects, etc...
Btw. What is the preferred mock framework? I have seen a dependency in one plugin to easymock but did not find any test that uses it. Is there a reason why no unit test uses any mock framework?


-----Urspr√ľngliche Nachricht-----
Von: tycho-dev-bounces@xxxxxxxxxxx [mailto:tycho-dev-bounces@xxxxxxxxxxx] Im Auftrag von Oberlies, Tobias
Gesendet: Montag, 06. Oktober 2014 14:32
An: Tycho developers list
Betreff: Re: [tycho-dev] Error when using AbstractTychoMojoTestCase

Hi Martin,

Without having looked into the details, I think that we don't have AbstractTychoMojoTestCase tests in the p2-modules of Tycho because this would require that Tycho's OSGi runtime is fired up. AFAIK, this would not work with the test harness. This also would explain the error message because "tycho-bundles-external" builds a zip file with the non-Tycho bundles in Tycho's OSGi runtime.

Note however that I haven't tried all this out myself. The tycho-p2-repository-plugin was contributed by Jan and myself when we were quite new to the project. So we may just not have been aware of this test harness, and you may in fact get it to work.

However before investing more into this, I wonder if it wouldn't be possible to test what you want by initializing the Mojo class yourself instead using the test harness.


> -----Original Message-----
> From: tycho-dev-bounces@xxxxxxxxxxx [mailto:tycho-dev- 
> bounces@xxxxxxxxxxx] On Behalf Of SCHREIBER.Martin
> Sent: Donnerstag, 2. Oktober 2014 12:45
> To: tycho-dev@xxxxxxxxxxx
> Subject: [tycho-dev] Error when using AbstractTychoMojoTestCase
> Hi,
> within a tycho-plugin I tried to add a Unit test. This plugin (p2-
> repository-plugin) did not had any test till now, so I added the 2
> dependencies:
> <dependency>
>    <groupId>org.eclipse.tycho</groupId>
>    <artifactId>tycho-testing-harness</artifactId>
>    <version>${project.version}</version>
>    <scope>test</scope>
> </dependency>
> <dependency>
>    <groupId>org.apache.maven</groupId>
>   <artifactId>maven-compat</artifactId>
>   <scope>test</scope>
> </dependency>
> When I run the test which does
>         File basedir = getBasedir("additionalFiles");
>         getSortedProjects(basedir, null);
> ("additionalFiles" is a directory containing a pom.xml file within the 
> "src/test/resources/" directory), the test fails complaining that the 
> "tycho-bundles-external" is missing (see attachment).
> I tried to look at other plugins but could not find any difference in 
> the dependencies or in the settings.
> Any suggestions?
> Thanks
> Martin

tycho-dev mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit

Back to the top