I am a new member in Tycho mailing list.
I do not know the history how the Tycho Surefire was created and what
reasons were in the background.
The reasons are quite similar to Tycho itself: for Eclipse plugins, we usually use p2 as dependency resolver and launch applications using the Eclipse Equinox runtime; and Maven doesn't target any of both as "default" target (which is fair as it's a kind of corner-case).
Plain Maven surefire doesn't understand p2 dependency resolution and isn't able to get the right dependencies to run Eclipse tests; p2 dependencies indeed do not map to the actual Maven dependency model, so Tycho passes additional state information about the project to tycho-surefire-plugin, which exploits them to generate the right test application. TestMojo.getIUsToInstall() shows the Tycho specific stuff.
But indeed, despite those major differences, we'd love to have the tycho-surefire-plugin as much as possible capable of reusing the maven-surefire-plugin, and we'd be glad to see some pieces of Tycho being able to move upstream to maven-surefire-plugin if it can help there.
It's just unclear what can easily be done towards more factorization; and I think most of the work would actually more something to perform on Tycho side. The most obvious would be a way for tycho-surefire-plugin to "inherit" the parameters from maven-surefire-plugin. Would you know a way to do that?
Basically, I would like to know if Maven Surefire would be also the right place for running the OSGi tests.
Plain OSGi tests in pure Maven way of dependency management, yes. And I think many already do that. I guess it's mostly a matter of having a specific "starter" for OSGi in maven-surefire-plugin. The Felix or BND people will most likely be more helpful here.
And opposite is also important to know. I guess you may tell me
the objective reasons why Maven Surefire was not the right plugin for
the OSGi. Do you think that we can do something in Maven Surefire to
fully enable the OSGi tests as well?
It's not about OSGi, it's about p2 and Eclipse specificities (which are the essence of Tycho). Plain Maven-style OSGi is better handled by other plugins like Felix and BND ones.