Skip to content
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

tycho-surefire-plugin does not find junit5 suite #1097

Closed
carstenartur opened this issue Jun 30, 2022 · 11 comments
Closed

tycho-surefire-plugin does not find junit5 suite #1097

carstenartur opened this issue Jun 30, 2022 · 11 comments

Comments

@carstenartur
Copy link
Contributor

carstenartur commented Jun 30, 2022

You can see what I mean looking at the pull request at
eclipse-jdt/eclipse.jdt.ui#129
It contains a suite like this:

@SelectPackages({"org.eclipse.jdt.internal.common"})
@Suite
public class JUnit5TestSuite {

}

The pom file contains

<build>
    <plugins>
      <plugin>
        <groupId>org.eclipse.tycho</groupId>
        <artifactId>tycho-surefire-plugin</artifactId>
        <version>${tycho.version}</version>
        <configuration>
          <useUIHarness>true</useUIHarness>
          <useUIThread>true</useUIThread>
          <includes>
            <!--<include>org/eclipse/jdt/ui/tests/AutomatedSuite.class</include>-->
            <include>org/eclipse/jdt/internal/common/JUnit5TestSuite.class</include>
             <!--<include>org/eclipse/jdt/ui/tests/LeakTestSuite.class</include> -->
          </includes>
          <dependencies>
            <dependency>
              <type>eclipse-plugin</type>
              <artifactId>org.eclipse.equinox.event</artifactId>
              <version>0.0.0</version>
            </dependency>
          </dependencies>
          <argLine>${leakTestsArgLine}</argLine>
        </configuration>
      </plugin>
    </plugins>
  </build>

Unfortunately tycho does not find the junit5 suite. As soon as I exchange the entry with the (single) junit5 test class VisitorTest it works fine.

@laeubi
Copy link
Member

laeubi commented Jun 30, 2022

@carstenartur can you provide an integration-test to demonstrate the issue?

@carstenartur
Copy link
Contributor Author

I just tried to setup eclipse for tycho development but just have ran into an error:
image
maybe there has been some github migration and it is not finished?
image
At least the oomph setup seems to be pointing to the no longer existing gerrit based git repositories unless I'm not mistaken...

@laeubi
Copy link
Member

laeubi commented Jul 1, 2022

@carstenartur you can setup an example project first, and import only the itest-project, you don't need a full IDE setup.

@carstenartur
Copy link
Contributor Author

Tbh currently I think it would be more useful in this concrete case to find out how I can run the tests in the jdt.ui pull request without tycho. So the question is how I can mix - everything else running through tycho and some new tests using surefire directly. It looks like this is much faster.
But I will try something to extract the issue into a sample project as soon as I find some time.
Thanks so far!

@laeubi
Copy link
Member

laeubi commented Jul 2, 2022

Tbh currently I think it would be more useful in this concrete case to find out how I can run the tests in the jdt.ui pull request without tycho.

No one forces you to run them with Tycho :-)

So the question is how I can mix - everything else running through tycho and some new tests using surefire directly.

Simply use eclipse-plugin as packaging and configure maven-surefire as you like.

@Bananeweizen
Copy link
Contributor

Might this be just a naming problem? Your Suite name does not match any of the default include patterns: https://www.eclipse.org/tycho/sitedocs/tycho-surefire-plugin/test-mojo.html#includes

@carstenartur
Copy link
Contributor Author

Might this be just a naming problem? Your Suite name does not match any of the default include patterns: https://www.eclipse.org/tycho/sitedocs/tycho-surefire-plugin/test-mojo.html#includes

You mean the explicit directive does not help?
Hm, something to test. It looks like in the documentation you mentioned the construct used in jdt.ui is not described

@Bananeweizen
Copy link
Contributor

The include configuration takes Java source names, not class file names. But besides that I really recommend naming suites no different than other tests. I've run into the issue of non-execution because of not being named FooTest or TestFoo way too often in multiple tools already.

@carstenartur
Copy link
Contributor Author

Here you see some documentation that claims default pattern is using ".class" ending.
I guess what is needed is an option to make the search patterns applied visible in the log.
It is just too intransparent what is going on otherwise.
https://www.eclipse.org/tycho/sitedocs/tycho-surefire-plugin/plugin-info.html
However, it could easily be that I'm completely wrong. I did not check the sourcecode.

@davu-all
Copy link

Hi I am experiencing the same problem.
I am trying to run my tests on Tycho 4.0.0 with the tycho-surefire-plugin.
It recognises the junit5 test classes but if i specify in the "includes" parameter only the junit5 testsuites then it says that no tests have been found.

@carstenartur
Copy link
Contributor Author

Meanwhile we migrated to Junit5 Suites so this is not needed any longer.
See eclipse-jdt/eclipse.jdt.ui#1669

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants