1
votes

To begin with: yes i have searched and basically tried everthing i could find here and in other Blogposts. I'm an intern and trying to get a project running again, after i upgraded all the dependencies and eclipse itself. In particular the project got upgraded to 64bit and Junit5. So the general required project structure etc. worked before, but now i have to migrate Junit4 to Junit5.

Project structure: I have a multi-package setup, which contains our product (an eclipse application), a "tests plugin" package containing all the test classes and an additional "test.suite" package, which holds a test suite to execute the tests from the previous plugin (to avoid circular dependencies). The pom of the test suite package contains all the building logic, which is:

  1. install product
  2. install tests plugin
  3. tycho should fire the tests.

so as visual aid the project is like this:

  • some product packages
  • tests plugin package ( contains test classes )
  • test suite package ( contains "test suite" and pom with "tycho" and installation workflow

Problem: since Junit5 the "test suite class" in the "test suite package" cannot execute the tests in the other package as the Junit TestEngine is not found (couldn't fix that either). Copying that "test suite class" into the "tests plugin package" works fine though and all tests run properly when executed in Eclipse as plugin test. When using the maven build, i point maven to a "test suite" through a command line argument. This worked on the old version, but now i try to use the suite at the "test plugin package", as thatone works in eclipse, but apparently the tests don't run in this case. No error, just 0 runs, 0 skipped 0 failures 0 Errors, Build succesfull.

As the pom which is building/installing/ etc. is in the "test suite" package i suspected that moving the test suite to the "tests plugin" package requires additional steps to work. I tried pointing various paths (source/ test-work.directory/testclassesdirectory...) from the pom to that new suite location, no success.

i have tried every code snipped i could find but i could not get maven to execute those tests. the biggest "success" was this: https://mukis.de/pages/simple-junit-tests-with-tycho-and-surefire/ when adding that snipped to my pom, i got the error found "duplicated classes" for the tests classes... As long as the "compiler-plugin" from the snipped was inside my pom i had duplicates, removing it gave me none at all. Trying to disable duplicates through "compilerarguments" on the maven compiler didnt work either.

I know my problem is vague and my explanation and skills are weak, but i appreciate any hints/discussions or examples on what to do. Considering the given project structure, how would one normaly configure tycho ( running integration tests installed as plugin into my application)?

Edit: this is the latest try in the test suite pom:

<plugin>
            <groupId>org.eclipse.tycho</groupId>
            <artifactId>tycho-surefire-plugin</artifactId>
            <version>${tycho-version}</version>
            <configuration>     
                <testClassesDirectory>../xxx.tests\src\[some dirs]\tests</testClassesDirectory>     
                <includes>
                    <include>**/*Test.xtend</include>
                </includes>        
                <failIfNoTests>false</failIfNoTests>
                <useUIHarness>true</useUIHarness>
                <useUIThread>false</useUIThread>
                <argLine>${tycho.testArgLine} ${memoryArgs}</argLine>
                <work>${test-work-directory}</work>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>2.19.1</version>
            <executions>
                <execution>
                    <goals>
                        <goal>integration-test</goal>
                        <goal>verify</goal>
                    </goals>
                    <configuration>
                        <testClassesDirectory>../xxx.tests\src\[some dirs]\tests</testClassesDirectory>
                            <includes>
                                <include>**/*Test.xtend</include>
                            </includes> 
                    </configuration>
                </execution>
            </executions>
        </plugin>

i tried without the paths and also letting them point to the compiled and uncompiled directorys.

best regards

1
added current pom snipped, where i tried also to use maven-failsafe-plugin ontopsimon

1 Answers

0
votes

I spend more then a month on this and just a day after posting i find the solution by accident... but i rather not complain

Solution:

  • inside two files (*plugin.java, .project) from that plugins was a typo which was not found by the compiler, but only by manual search. It came from an old renaming cycle, but maven or eclipse didnt throw an error...

  • as i said we used a command line parameter to point maven to the test suite. apparently that is not necessary anylonger. I do not know if its a junit5 thing, but the test classes in the "osgi" environment (they are packed and installed as plug-in) where all found when i didn't provide any testclass link to maven.