-
Notifications
You must be signed in to change notification settings - Fork 189
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
JUnit 5 Test Suite not working - "No tests found" #2462
Comments
If I place a dummy test inside the @Suite
@SelectClasses({
FooTest1.class,
FooTest2.class
})
@SuiteDisplayName("All Tests")
public class AllTests {
@Test
public void foo() {
}
} |
I had a brief look at it the other day, because we ran into a similar situation and I think there are two reasons why the JUnit 5 test suites don't work:
|
As always it would be great to provide an integration-test to demonstrate the issue. Nerveless one main problem might be that Tycho has a pre-check that, if triggered, skips the execution all together, so the first step should be to check if the suite is detected at that stage already. |
I tried, I really did, but gave up in sheer frustration in getting the workflow to run. |
I can have a look at it this afternoon as well. Given that I played around with it for a little bit, there should be a small test project I can add to the integration tests.
In short: The problem is that the SuiteTestEngine (or any of the JUnit suite jarts for that matter), which is required to handle those Suite annotations, is not included in the |
@Phillipus if you are a first-time contributor workflows need approval from a committer, in such case simply ask on the PR and I'll take a look at it. In general if existing documentation is not sufficient please let us know so we can improve those: |
@ptziegler yes the existing tycho-surefire way of adding test dependencies is rather verbose and cumbersome. it should hopefully find/pull everything automatically. If there is any feature missing with that please let me know at best |
This is most probably related to |
I am not into the details, but #3247 refers to test selection patterns, which I would expect to be independent of whether a single test or a test suite is executed. For that reason, I am not sure whether this issue is actually related. I have now provided an integration test in #3342, which fails as expected because no tests are found when executing a test suite:
|
It all relates a bit, maybe its enough to add some more dependencies but in the end we should not need all this as surefires seems to be able to do this successful already, so we should adopt to it as much as possible. Nevertheless do you plan to debug/work on this? |
I have now digged a big into the issue and think you are right. With a pure Maven setup, test suites are executed as long as
I would really like to do so, but after I now had a first look into the code I think that due to lack of experience with the technologies it will probably take too long for me to achieve an "acceptable cost/benefit ratio". But of course I am aware that no one else will work on the issue as long as it's not pressing for them. |
It all depends a bit how important that one becomes, I can try to spend some time on it as part of the platform-releng (if it is important for platform...) |
Being able to use latest JUnit is important in general but when there are people (like @HeikoKlare ) actively improving the tests it becomes even more IMHO. |
I see several reasons why platform tests should use latest JUnit (capabilities):
With respect to this suites issue, I think that I can also work around that for some time by (temporarily) replacing test suites with include/exclude definitions for Tycho surefire (particularly required to not execute performance tests). Existing projects in Platform UI using JUnit 5 do the same: in Tycho builds, they simply execute all available tests and ignore the provided JUnit 5 test suite. Anyway, that should not be the final solution but only ensure that missing test suite support in JUnit 5 is not a blocker for migration. |
Actually these suite where more a workaround for me because of the crippled ant based test execution that don't allow to select test by a pattern, but you are right it should work of course. Skipping tests is also better handled by assumptions than by test suites or filter patterns. |
Agreed. In my opinion, test suites should actually only be an (optional) means of structuring, not for filtering. Further InsightsHere are some more insights from further debugging the issue, which might help for further processing. To ensure that the Then I found the following things worth to document:
So from my understanding the code should automatically load and execute the It can also be seen that the Lines 219 to 220 in 36fd6a9
Then the ServiceLoader finds the SuiteTestEngine but throws an error because the ServiceLoader cannot assign it to TestEngine (probably because the class loaders use different / incompatible versions of JUnit platform).
|
Currently, Tycho is not capable of running JUnit 5 test suites, since the requires SuiteTestEngine is not provided while running tests. This change adds the SuiteTestEngine to tycho-surefire executions using JUnit Platform 1.8 (the first with suite support) or newer. To this end, the SuiteTestEngine is always enabled when running JUnit 5 tests. It also adds a regression test for executing a test suite based on JUnit Jupiter 5.9. Fixes eclipse-tycho#2462
Currently, Tycho is not capable of running JUnit 5 test suites, since the required SuiteTestEngine is not provided while running tests. This change adds the SuiteTestEngine to tycho-surefire executions using JUnit Platform 1.8 (the first with suite support) or newer. To this end, the SuiteTestEngine is always enabled when running JUnit 5 tests. It also adds a regression test for executing a test suite based on JUnit Jupiter 5.9. Fixes eclipse-tycho#2462
Currently, Tycho is not capable of running JUnit 5 test suites, since the required SuiteTestEngine is not provided while running tests. This change adds the SuiteTestEngine to tycho-surefire executions using JUnit Platform 1.8 (the first with suite support) or newer. To this end, the SuiteTestEngine is always enabled when running JUnit 5 tests. It also adds a regression test for executing a test suite based on JUnit Jupiter 5.9. Fixes eclipse-tycho#2462
I finally found the reason and a solution for missing suite support. It is actually only a configuration problem. Properly registering the |
Currently, Tycho is not capable of running JUnit 5 test suites, since the required SuiteTestEngine is not provided while running tests. This change adds the SuiteTestEngine to tycho-surefire executions using JUnit Platform 1.8 (the first with suite support) or newer. To this end, the SuiteTestEngine is always enabled when running JUnit 5 tests. It also adds a regression test for executing a test suite based on JUnit Jupiter 5.9. Fixes eclipse-tycho#2462
Currently, Tycho is not capable of running JUnit 5 test suites, since the required SuiteTestEngine is not provided while running tests. This change adds the SuiteTestEngine to tycho-surefire executions using JUnit Platform 1.8 (the first with suite support) or newer. To this end, the SuiteTestEngine is always enabled when running JUnit 5 tests. It also adds a regression test for executing a test suite based on JUnit Jupiter 5.9. Fixes #2462 (cherry picked from commit 82dd36b)
Thanks to everyone who worked on this, especially @HeikoKlare for running with it. :-) What little I can offer in return is some immediate user feedback:
👍 |
Thanks for the feedback, @Phillipus! Great to hear that you could verify that it works as expected. |
Currently, Tycho is not capable of running JUnit 5 test suites, since the required SuiteTestEngine is not provided while running tests. This change adds the SuiteTestEngine to tycho-surefire executions using JUnit Platform 1.8 (the first with suite support) or newer. To this end, the SuiteTestEngine is always enabled when running JUnit 5 tests. It also adds a regression test for executing a test suite based on JUnit Jupiter 5.9. Fixes #2462 (cherry picked from commit 82dd36b)
|
I'm trying to execute a JUnit 5 Test Suite using Tycho Surefire. The suite is this:
This runs in Eclipse itself, but not using Maven/Tycho. Error is "Failed to execute goal org.eclipse.tycho:tycho-surefire-plugin:3.0.4:test (default-test) on project test.package.tests: No tests found."
Attached is a simple test project. Run with
mvn clean verify
Tested on Tycho 3.0.4 and 4.0.0-SNAPSHOT
test.zip
The text was updated successfully, but these errors were encountered: