-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Mojos to replace "The Eclipse Test Framework" #3058
Conversation
31de496
to
24338f6
Compare
I think the case of running tests inside a pre-existing application is already covered by https://tycho.eclipseprojects.io/doc/latest/tycho-surefire-plugin/test-mojo.html#testRuntime . What is missing that requires further development in Tycho? |
@mickaelistria this is solely to replace the current ant based solution of "The Eclipse Testing Framework" in two cases
Also this requires to have a quite complicated and boilerplate setup with Another issue is that this "Eclipse Test Framework" seems not very well understood and not maintained anymore (the wiki page still mention Java 1.5) and I like to demystify that and offer a Tycho alternative so we probably can deprecate the old ant-based way one time fr platform. If you could help to use instead the default tycho-sure-fire that would be great, but every time I asked for that in the past it was only "should work but we have not capacity/knowledge/..." and as it is quite easy now to just call the code in Eclipse itself wit little effort this seems a good way forward (even fro those that might still want to use that Eclipse Testing Framework). |
24338f6
to
196c841
Compare
This now has reached state of basic operation so I mark this ready as it could potentially be merged... |
This integration-test https://github.com/eclipse-tycho/tycho/blob/f7d89236fc0fc0ce48a0d972d0e686440aef21bd/tycho-its/projects/surefire.p2InstalledRuntime/extProductTest/pom.xml shows how to setup Tycho so the test is executed in a given product installation. These settings could be part of a But I'm still curious about the overall plan: at the moment, the tests are run exactly without Tycho, because there are no artifacts produced and they're only orchestration, so it doesn't really fit the Maven approach; we also don't re-compile tests as part of the test execution. |
I'm not sure if this is true, these test.xml do ALOT of stuff that needs manual crafting (e.g. what should be installed what test to run in what order with what runner and so on), so actually there is something produced, that is we build a customized eclipse product based on the sdk.
Also Tycho/Maven can run things without producing artifacts (e.g. with pom packaging).
Recompilation is not required, e.g. equinox uses the precompiled osgi TCKs to run the TCK suite against equinox implementations.
Just take a look at that monster ...
Bash scripts only run on Linux (maybe mac) |
Can you please share links to such test.xml that perform such extra steps?
Yes, but it's kind of clunky as one has to produce at least 1 extra artifact to run such a script: the pom.xml ;) and then decide where to maintain it and so on to be discoverable by the build script. # bash pseudo/untested-code
wget https://download.eclipse.org/eclipse/downloads/drops4/I20231119-1800/download.php?dropFile=eclipse-platform-I20231119-1800-linux-gtk-x86_64.tar.gz
unzip eclipse-platform-I20231119-1800-linux-gtk-x86_64.tar.gz
cd eclipse
eclipse -application org.eclipse.p2.equinox.director -repository https://download.eclipse.org/eclipse/updates/4.30-I-builds/ -installIU org.eclipse.sdk.tests.features.group
for testPlugin in $(ls -1 plugins/*.tests.jar); do
rm text.xml #cleanup
tax xz $testPlugin test.xml
testType=xmllint --xpath '//ant/target[value()=="*-tests"]' test.xml
testApplication=org.eclipse.core.tests.application
if [ "$testType" == "*ui* ]; then
testApplication=org.eclipse.ui.tests.application
fi
testClass=xmllint --xpath '//ant/target[value()=="*-tests"]/property[name="classname"]/value()' test.xml
eclipse -application $testApplication -out TEST-$testPlugin.xml
fi |
It's even worse right now as it's not using test.xml in the bundle to define the extra deps but it's part of the main/share one the https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/blob/master/production/testScripts/configuration/sdk.tests/testScripts/test.xml#L34 . |
https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/blob/4b5fccff1c7878e02430c22ede26c8788c60896e/production/testScripts/configuration/sdk.tests/testScripts/test.xml#L34 and following hundreds of lines
How is this better than an ant/pom beside that it only runs on linux and also has several preconditions to be meet and special knowledge to understand? |
You do you like to indicate we actually can delete all |
No, as the bundle test.xml contains the test suite to be actually run. |
This one is more or less what I think we can replace with a ~20 lines shell script + better instructions in p2.inf to properly define test dependencies in a portable way. We don't ship delta pack any more and this actually seems more like a precondition that could be setup in the test case directly.
There are many more people who can maintain bash than people who can maintain Ant/Pom. Bash is the language of DevOps, the language of orchestration that everyone is taught in university. Bash runs on all OSs (even Windows using the Linux subsystem), and on all cloud infras. But let's get back to the initial topic. I've lost track and while going through the discussion, it still remained unclear: what is the problem that we're willing to fix for the SDK build? Some test issues? Too much unmaintainable Ant?... How the current proposal in this PRs fixes it better than discussed alternatives? |
Can you then provide a PR for that?
Can you then provide a PR for PDE so this test bundle is executed as part of the regular verification build? Currently we only see failures in ibuild what is too late and time consuming to fix/analyze/verify...
"bash" is useless without the context of Eclipse/Tycho/... here imo but in the end I don't care if it is the agreement of platfrom.releng to replace maven builds with bash scripts I just don't want:
Get rid of "The Eclipse Testing Framework" in its current ant based unmaintainable state.
This PR does not fix anything it just might allows to replace hundred of merely duplicated test.xml deleted and as a step forward in this, the alternatives are already mentioned here and there, but actually not action is taken to apply them because of some issues they do not cover. So in the past it has helped a lot to first replace ant>maven and improve on top of that instead of wait for the big-bang that never happens. |
I may try, but are there some issues about these particular problems/goals? As I'm looking at many things at the same time I too easily forget things if I don't have a tab open about it.
The testSuite still needs to be discoverable somewhere to run the proper tests; and the file has to be embedded in the bundle (also for it to be discovered later). At the moment, it's test.xml and it's mostly boilerplate/useless. What would be a better alternative? A test.properties file? Or some entries in some other common file? (IIRC, build.properties is not viable because it's not embedded by default), or should we include new files in the bundle jar...?
I don't think the problem is much related to the test framework here, those are issues specific to some test cases and bundles, for which I expect a specific solution of p2.inf + Java code inside the bundle can solve 90% of cases in a very portable way.
I think other build parameters are the same story as the suite name above. If one want the test to be "portable" and reliable, it must contain all instructions for proper execution (test suite to run, specific parameters, dependencies). Then, once all that is easily accessible, it becomes easy to run them reliably with whatever technology that is OK reading those parameters without need for further specific configuration tweak (ideally could be a pom.xml, or a bash script or whatever not Ant; what matters is really that it doesn't do much test-specific config per se). |
There is not a dedicated issue but
There is some (semi) OSGi standards I try to standardize at the moment used by the OSGi-TCKs that is using a Manifest header (
That's what Requirements and Capabilities are for But I won't mind if there is one "setup the integration test" that configures things, as long as it does those in a way that reuses all information from the build/pom/wherever and only adds the specifics of the test (e.g. using mac with webkit ...) |
Exactly, but the issue is in choosing the right "whatever" so it can serve all the flavors of installing and launching tests we care about (ie surefire during build or test execution in a next process). |
Neither a shell script nor this mojo solves the problem that we do more things than "launch the test" in platform.... |
I see the goal is to directly reuse the applications, but while it's good to reuse as much as possible the applications per se wouldn't really solve the problem that some tests have pre-requisite (currently in text.xml), so this proposal wouldn't help in resolving the issue as the test.xml is not read by the org.eclipse..tests.application, it read by the org.eclipse.core.ant.antRunner application which then calls the test application. |
Surefire currently would execute an annotated/configured test with the surefire-junit runner, while as you mentioned this here would use the https://wiki.eclipse.org/Platform-releng/Eclipse_Test_Framework
So as Tycho already supports bnd-testing and is an Eclipse project and is used for Platfrom it seems fair to have a way to execute such tests with Tycho as well, not that I would recommend that or think its better its just different. |
The Eclipse Test Framework is a way to specifically run a test inside an eclipse installation itself against a prebuild SDK. This implements the framework on top of maven to make it much easier to run and setup than with the several (ant) prerequsites of the original description provided here: - https://wiki.eclipse.org/Platform-releng/Eclipse_Test_Framework - https://wiki.eclipse.org/Platform-releng/Automated_Testing as well as offer much more flexibility e.g. to run tests in a local mode where not the SDK but a local build is used as the test base.
196c841
to
e32408c
Compare
Rebase on master to only include the essentials... |
I'm closing this for now even though it was a quite interesting journey and has raveled some bugs/missing features in the Embedded Eclipse Launcher... but it seems note useful to keep this technique alive by making it easier to use with Tycho with no strong demands... |
The Eclipse Test Framework is a way to specifically run a test inside an eclipse installation itself against a prebuild SDK.
This implements the framework on top of maven to make it much easier to run and setup than with the several (ant) prerequsites of the original description provided here:
as well as offer much more flexibility e.g. to run tests in a local mode where not the SDK but a local build is used as the test base.