Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-user] Tycho + source folder containing tests

I'm currently digging the sources and found that sure-fire-plugin requires "eclipse-test-plugin" packaging, but literally all places in the code referencing "eclipse-test-plugin" doing so to handle "eclipse-test-plugin" the same as "eclipse-plugin"... So this feels like were doing all this stuff just for the sake to tell "can be run with sure-fire".

About your second point "build.properties":

- if I create a source-folder "testme" then PDE complains in build.properties: "testme is missing from sources" - as soon as I mark this folder "contains test sources" the warning goes away!

That makes completely sense as I of course don't want to include / compile test sources in my final bundle! (I suppose that would happen if I include it in the source).

About "surefire requires the bundle to be build":

if I take a look at [1] there are separate phases for compiling "normal" classes and test-classes, so maybe a very first step would be that tycho actually compile marked test-source folders in this phase?

next step seems for me that as tycho-surefire runs in the integration-test phase the package might be enhanced to actually produce two artifacts:

- plugin_version.jar
- plugin-test_version.jar

where the second simply contains additional all classes from the "test-compile" phase

as a last step, surefire-plugin must check not for the "eclipse-test-plugin" but also for existence of an attached "plugin-test" artifact and the use this to run.

beside that, it would be good if we could run test that don't require an OSGi-Framework to run in the "test" phase. Could this be archived with traditional maven-surefire (e.g. will it "see" the plugin dependencies?) or will this require an extension to the tycho-surefire plugin?

As it seems currently there is no support for this usecase and we are creating something new we should defiantly take into account how to make this works more nice than currently. For example I could think about that we add additional properties to the classpath entry (like the "maven derived" that tells surefire if this is a folder for
- plain unit test
- eclipse plugin test
- eclipse plugin test require ui-harness

If we can get consensus about this I might be possible to add support for some of the steps described above.


[1] https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html



Am 29.03.21 um 15:32 schrieb Mickael Istria:


On Mon, Mar 29, 2021 at 3:18 PM Christoph Läubrich <laeubi@xxxxxxxxxxxxxx <mailto:laeubi@xxxxxxxxxxxxxx>> wrote:

    as I'm using tycho pomless tycho surefire is not enabled for my plugin.
    Would it have worked if I have had enabled surefire? Is surefire
    responsible to compile the test classes? Are source folders that
    contain
    test are explicitly excluded in the normal build?


From Tycho POV, the source folders are controlled by the build.properties file. Tycho just processes the build.properties file and ignores .classpath; so if you test folder is not in build.properties, it's ignored.. It would be a good possible enhancement that in case no build.properties exist, Tycho default to something smart enough from .classpath. I don't know how much PDE would like it or not though. If PDE can already handle that, then it brings even move value to having that in Tycho soon.

Now, for the case of having tests in the same module but not in the bundle package, I think it's kind of impossible with the way tycho-surefire-plugin runs the tests: tycho-surefire-plugin will provision an Eclipse application including the bundle, and the bundle would need to contain the test class for tycho-surefire-plugin to load them. It would be interesting to let Tycho automatically build a test fragment from the "test" source folders of the current module and make tycho-surefire-plugin include it. But it involves tweaking a lot of things in many mojo. The result would probably be great, but not easy to reach IMO.



_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/tycho-user



Back to the top