tycho icon indicating copy to clipboard operation
tycho copied to clipboard

tycho-surefire-plugin does not find junit5 suite

Open carstenartur opened this issue 3 years ago • 10 comments

You can see what I mean looking at the pull request at https://github.com/eclipse-jdt/eclipse.jdt.ui/pull/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.

carstenartur avatar Jun 30 '22 19:06 carstenartur

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

laeubi avatar Jun 30 '22 20:06 laeubi

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...

carstenartur avatar Jul 01 '22 17:07 carstenartur

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

laeubi avatar Jul 01 '22 17:07 laeubi

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!

carstenartur avatar Jul 02 '22 07:07 carstenartur

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.

laeubi avatar Jul 02 '22 07:07 laeubi

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

Bananeweizen avatar Jul 02 '22 11:07 Bananeweizen

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

carstenartur avatar Jul 02 '22 12:07 carstenartur

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.

Bananeweizen avatar Jul 02 '22 12:07 Bananeweizen

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.

carstenartur avatar Jul 03 '22 10:07 carstenartur

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.

davu-all avatar Jul 17 '23 10:07 davu-all