Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Problem running junit plugin tests with CDT parent pom: No tests found

My guess is that you don't have a class called AutomatedIntegrationSuite in your test plug-in. This is not a requirement, but rather the CDT default as defined in the root pom.xml (which overrides the default default in surefire). If you want to have custom surefire configuration you need to provide your own settings in your pom.xml - specifically the tycho-surefire-plugin/configuration/includes/, see https://www.eclipse.org/tycho/sitedocs/tycho-surefire-plugin/test-mojo.html#includes

For example, when I recently added TM.terminal to CDT's build I created a new class: https://git.eclipse.org/r/#/c/156965/1/terminal/plugins/org.eclipse.tm.terminal.test/src/org/eclipse/tm/terminal/test/AutomatedIntegrationSuite.java

The default is defined in root pom: https://git.eclipse.org/r/plugins/gitiles/cdt/org.eclipse.cdt/+/master/pom.xml#886 and by placing a file in the root of the bundle, you can use other pre-canned defaults (eg. UI testing: https://git.eclipse.org/r/plugins/gitiles/cdt/org.eclipse.cdt/+/master/pom.xml#463).

However, if the defaults don't work for you, the pom.xml needs to be written, for example DSF-GDB tests have their own unique settings: https://git.eclipse.org/r/plugins/gitiles/cdt/org.eclipse.cdt/+/master/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/pom.xml

I have answered some other questions inline to your email below.

On Mon, 10 Feb 2020 at 14:58, 15 knots <fifteenknots505@xxxxxxxxx> wrote:
Hi,

I'm currently trying to build some of my plugins with the CDT parent pom.
excerpt from the build log

[INFO] --- tycho-surefire-plugin:1.6.0:test (default-test) @
org.eclipse.cdt.cmake.is.core.tests ---
[INFO] Expected eclipse log file:
/home/15knots/devel/fremd/cdt/cmake/org.eclipse.cdt.cmake.is.core.tests/target/work/data/.metadata/.log
[INFO] Command line:
    [/usr/lib64/jvm/java-1.8.0-openjdk-1.8.0/jre/bin/java,
-Dosgi.noShutdown=false, -Dosgi.os=linux, -Dosgi.ws=gtk,
-Dosgi.arch=x86_64, -javaagent:/home/15knots/.cache.
..
Results:
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
...
[ERROR] Failed to execute goal
org.eclipse.tycho:tycho-surefire-plugin:1.6.0:test (default-test) on
project org.eclipse.cdt.cmake.is.core.tests: No tests found. -> [Help
1]

In the metadate/.log I see the following

BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=de_DE
Framework arguments:  -application
org.eclipse.tycho.surefire.osgibooter.headlesstest -testproperties
/home/15knots/devel/fremd/cdt/cmake/org.eclipse.cdt.cmake.is.core.tests/target/surefire.properties
-product org.eclipse.platform.ide -pluginCustomization
/home/15knots/devel/fremd/cdt/cmake/org.eclipse.cdt.cmake.is.core.tests/../../disable_intro_in_tests.ini
Command-line arguments:  -data
/home/15knots/devel/fremd/cdt/cmake/org.eclipse.cdt.cmake.is.core.tests/target/work/data
-application org.eclipse.tycho.surefire.osgibooter.headlesstest
-testproperties
/home/15knots/devel/fremd/cdt/cmake/org.eclipse.cdt.cmake.is.core.tests/target/surefire.properties
-product org.eclipse.platform.ide -pluginCustomization
/home/15knots/devel/fremd/cdt/cmake/org.eclipse.cdt.cmake.is.core.tests/../../disable_intro_in_tests.ini

!ENTRY org.eclipse.compare.win32 4 0 2020-02-10 20:36:27.118
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module:
org.eclipse.compare.win32 [225]
  Unresolved requirement: Require-Capability: eclipse.platform;
filter:="(osgi.os=win32)"

Why does eclipse require the win32 stuff?

Eclipse doesn't exactly require it - something in the target platform is causing Tycho to add o.e.compare.win32 to the set of bundles included when launching, but then it is unresolved because of the platform difference. This could be a tycho issue or an issue in CDT's target platform. However I don't really understand the issue, but I do know it can be ignored.
 
Could that be the problem?

No. 


 

Originally, all tests ran fine with the /maven/-surefire-plugin. Now
CDt runs them with the /tycho/-maven-plugin. Do I need to tweak my
test-plugins?

My guess is that you have unit tests that can run with maven surefire as they can run without OSGi (aka they can run as JUnit Tests and don't need to be run as JUnit Plug-in Tests)? The tycho extension to surefire understands OSGi and can launch accordingly. However the tycho tests are bound to the verify phase of maven, not test phase. 
 

When running maven with debug output, I can the that the test classes
are at the location wher surefire expects them:

I am not sure which line indicates that. The line that says "includes = " shows what pattern surefire is looking for (as mentioned above)
 

[INFO] --- tycho-surefire-plugin:1.6.0:test (default-test) @
org.eclipse.cdt.cmake.is.core.tests ---
[DEBUG] Configuring mojo
org.eclipse.tycho:tycho-surefire-plugin:1.6.0:test from plugin realm
ClassRealm[plugin>org.eclipse.tycho:tycho-surefire-plugin:1.6.0,
parent: sun.misc.Launcher$AppClassLoader@70dea4e]
[DEBUG] Configuring mojo
'org.eclipse.tycho:tycho-surefire-plugin:1.6.0:test' with basic
configurator -->
[DEBUG]   (f) appArgLine = -pluginCustomization
/home/15knots/devel/fremd/cdt/cmake/org.eclipse.cdt.cmake.is.core.tests/../../disable_intro_in_tests.ini
[DEBUG]   (f) argLine =
-javaagent:/home/15knots/.cache/m2/repository/org/jacoco/org.jacoco.agent/0.8.5/org.jacoco.agent-0.8.5-runtime.jar=destfile=/home/15knots/devel/fremd/cdt/cmake/org.eclipse.cdt.cmake.is.core.tests/../../target/jacoco.exec,append=true,includes=org.eclipse.cdt.*
-Xms256m -Xmx512m -ea
[DEBUG]   (f) deleteOsgiDataDirectory = true
[DEBUG]   (s) type = p2-installable-unit
[DEBUG]   (s) artifactId = org.eclipse.platform.feature.group
[DEBUG]   (f) dependencies = [Dependency {groupId=null,
artifactId=org.eclipse.platform.feature.group, version=null,
type=p2-installable-unit}]
[DEBUG]   (f) enableAssertions = false
[DEBUG]   (f) failIfNoTests = true
[DEBUG]   (f) includes = [**/AutomatedIntegrationSuite.*]
[DEBUG]   (f) osgiDataDirectory =
/home/15knots/devel/fremd/cdt/cmake/org.eclipse.cdt.cmake.is.core.tests/target/work/data
[DEBUG]   (f) perCoreThreadCount = true
[DEBUG]   (f) pluginArtifacts = ...
[DEBUG]   (f) product = org.eclipse.platform.ide
[DEBUG]   (f) profileName = DefaultProfile
[DEBUG]   (f) project = MavenProject:
org.eclipse.cdt:org.eclipse.cdt.cmake.is.core.tests:1.0.0-SNAPSHOT @
/home/15knots/devel/fremd/cdt/cmake/org.eclipse.cdt.cmake.is.core.tests/pom.xml
[DEBUG]   (f) redirectTestOutputToFile = false
[DEBUG]   (f) reportsDirectory =
/home/15knots/devel/fremd/cdt/cmake/org.eclipse.cdt.cmake.is.core.tests/target/surefire-reports
[DEBUG]   (f) rerunFailingTestsCount = 0
[DEBUG]   (f) runOrder = filesystem
[DEBUG]   (f) session = org.apache.maven.execution.MavenSession@2e46ffd5
[DEBUG]   (f) showEclipseLog = false
[DEBUG]   (f) skipAfterFailureCount = 0
[DEBUG]   (f) surefireProperties =
/home/15knots/devel/fremd/cdt/cmake/org.eclipse.cdt.cmake.is.core.tests/target/surefire.properties
[DEBUG]   (f) testClassesDirectory =
/home/15knots/devel/fremd/cdt/cmake/org.eclipse.cdt.cmake.is.core.tests/target/classes

Any hints?

I hope the above resolves your questions.

As for the probable follow-on question, I don't know why it is like it is, but probably because of JUnit3 history when everything was defined as suites. I would be fine making the change across the board with new defaults. Indeed in many ways it would be an improvement as it can be easy to forget to add new tests to the suite.
 

Martin
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/cdt-dev

Back to the top