junit-team / junit5

✅ The 5th major version of the programmer-friendly testing framework for Java and the JVM
https://junit.org
Eclipse Public License 2.0
6.44k stars 1.5k forks source link

Cannot create Launcher without at least one TestEngine #673

Closed Vazzilena closed 7 years ago

Vazzilena commented 7 years ago

Hey,

I am running the following in gradle:

junitPlatform { filters { engines { include 'junit-platform', 'junit-vintage', 'junit-jupiter' } tags { include 'categories.TestClassifier.ReliableIntegrationTest' } } }

I believe I have configured the dependencies correctly:

dependencies { classpath ( "org.junit.platform:junit-platform-gradle-plugin:1.0.0-M3", ) }

apply plugin: "org.junit.platform.gradle.plugin"

configurations { externalLibraries compile.extendsFrom (externalLibraries) }

externalLibraries (group: 'org.junit.platform', name: 'junit-platform-commons', version: '1.0.0-M3') externalLibraries (group: 'org.junit.platform', name: 'junit-platform-console', version: '1.0.0-M3') externalLibraries (group: 'org.junit.platform', name: 'junit-platform-launcher', version: '1.0.0-M3') externalLibraries (group: 'org.junit.platform', name: 'junit-platform-runner', version: '1.0.0-M3') externalLibraries (group: 'org.junit.platform', name: 'junit-platform-gradle-plugin', version: '1.0.0-M3') externalLibraries (group: 'org.junit.platform', name: 'junit-platform-engine', version: '1.0.0-M3') externalLibraries (group: 'org.junit.vintage', name: 'junit-vintage-engine', version: '4.12.0-M3') externalLibraries (group: 'junit', name: 'junit', version: '4.12') externalLibraries (group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.0.0-M3') externalLibraries (group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.0.0-M3')

No matter how I adjust the engines (specify just one engine, list all or comment out the engine part entirely) I always run in this error. I believe it has in common with the filter option, because if I remove it all tests are picked up immediately. But I need the filter to narrow down tests with tags...

Any hints? Maybe I am missing something?

Feb 22, 2017 3:21:14 PM org.junit.platform.launcher.core.ServiceLoaderTestEngineRegistry loadTestEngines INFO: No TestEngine implementation discovered. org.junit.platform.commons.util.PreconditionViolationException: Cannot create Launcher without at least one TestEngine; consider adding an engine implementation JAR to the classpath at org.junit.platform.commons.util.Preconditions.condition(Preconditions.java:207) at org.junit.platform.launcher.core.DefaultLauncher.(DefaultLauncher.java:52) at org.junit.platform.launcher.core.LauncherFactory.create(LauncherFactory.java:53) at org.junit.platform.console.tasks.ExecuteTestsTask.executeTests(ExecuteTestsTask.java:61) at org.junit.platform.console.tasks.ExecuteTestsTask.lambda$execute$0(ExecuteTestsTask.java:57) at org.junit.platform.console.tasks.CustomContextClassLoaderExecutor.invoke(CustomContextClassLoaderExecutor.java:33) at org.junit.platform.console.tasks.ExecuteTestsTask.execute(ExecuteTestsTask.java:57) at org.junit.platform.console.tasks.ConsoleTaskExecutor.executeTask(ConsoleTaskExecutor.java:38) at org.junit.platform.console.ConsoleLauncher.execute(ConsoleLauncher.java:54) at org.junit.platform.console.ConsoleLauncher.main(ConsoleLauncher.java:39)

marcphilipp commented 7 years ago

Apparently, the engines are not on the testRuntime classpath. Please add them to the testRuntime configuration instead of externalLibraries as documented in the User Guide.

Vazzilena commented 7 years ago

I added testRuntime.extendsFrom (compile) and I get the same error. (Actually I read the user guide initially and tried it before posting here)

marcphilipp commented 7 years ago

Can you add println sourceSets.test.runtimeClasspath.files to your build.gradle for debugging purposes and post its output here?

Vazzilena commented 7 years ago

The runtime configuration gets printed as you suggested after the -------------------------->> signs. As far as I see the references are correct....

Using Gradle home..........C:\Users\vatre.gradle\wrapper\dists\gradle-3.3-bin\esqunkrn5a2dzwqfbsdmmdgqf\gradle-3.3 Using Gradle user home.....C:\Users\vatre.gradle Validation unsuccessful for property "name" in project "UniversalMessaging" with value "UniversalMessaging"; validation pattern: [a-z][a-z,0-9,-] Validation unsuccessful for property "group" in project "UniversalMessaging" with value ""; validation pattern: [a-z][a-z,0-9,.] Using UM repository: http://umartifactory.eur.ad.sag:8081/artifactory/um_10.0_production_artifacts/10.0.0.0.90096/java/test/ Classpath entry: C:\BF-5476/build/nirvana-dependencies/testServerFramework10.0.0.0.90096.jar Classpath entry: C:\BF-5476/build/nirvana-dependencies/testServerRunner10.0.0.0.90096.jar -------------------------->> [C:\BF-5476\prod\java\integration-test\staging\classes\test, C:\BF-5476\prod\java\integration-test\staging\resources\test, C:\BF-5476\prod\java\integration-test\staging\classes\main, C:\BF-5476\prod\java\integration-test\staging\resources\main, C:\BF-5476\build\nirvana-dependencies\test\jsr166y-1.7.0.jar, C:\BF-5476\build\nirvana-dependencies\test\classmexer.jar, C:\BF-5476\build\nirvana-dependencies\test\junit-toolbox-1.10.jar, C:\BF-5476\build\nirvana-dependencies\reflections\javassist.jar, C:\BF-5476\build\nirvana-dependencies\sag-sin-misc-95sp1_136.jar, C:\BF-5476\build\nirvana-dependencies\sag-sin-common-95sp1_136.jar, C:\BF-5476\build\nirvana-dependencies\reflections\reflections.jar, C:\BF-5476\build\nirvana-dependencies\xml-apis.jar, C:\BF-5476\build\nirvana-dependencies\jms.jar, C:\BF-5476\build\nirvana-dependencies\test\SwiftMQ\amqp-1.1.3.jar, C:\BF-5476\build\nirvana-dependencies\test\SwiftMQ\swiftmq-1.1.3.jar, C:\BF-5476\build\nirvana-dependencies\test\SwiftMQ\testsuite-1.1.3.jar, C:\BF-5476\build\nirvana-dependencies\testServerFramework10.0.0.0.90096.jar, C:\BF-5476\build\nirvana-dependencies\testServerRunner10.0.0.0.90096.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\net.sf.findbugs\findbugs\2.0.1\867271f9b34bbfa45785f7dd22d8a3f4bef147fa\findbugs-2.0.1.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\net.bytebuddy\byte-buddy-agent\1.5.3\a666e6ac0ef4ee60bd655ecc705c31fc4e56a24a\byte-buddy-agent-1.5.3.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\net.bytebuddy\byte-buddy\1.5.3\16248badf5fc7652cb9037a9f7cd09c11317b681\byte-buddy-1.5.3.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\org.mockito\mockito-core\1.9.5\c3264abeea62c4d2f367e21484fbb40c7e256393\mockito-core-1.9.5.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\org.objenesis\objenesis\2.1.0\87c0ea803b69252868d09308b4618f766f135a96\objenesis-2.1.0.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\org.apache.qpid\qpid-amqp-1-0-common\0.32.0\e9647120b2778e8e7737785ea58455e747258c93\qpid-amqp-1-0-common-0.32.0.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\org.apache.qpid\qpid-amqp-1-0-client-jms\0.32.0\a4101cc58029f4b552f203317b3851de59550941\qpid-amqp-1-0-client-jms-0.32.0.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\org.apache.qpid\qpid-amqp-1-0-client\0.32.0\daa258b99f6d5ba6b2299d97f29240509e201e8e\qpid-amqp-1-0-client-0.32.0.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\io.netty\netty-all\4.0.17\6ffa8517ca9263207532dd83dde08caa547ce5d6\netty-all-4.0.17.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\org.apache.qpid\qpid-jms-client\0.3.0\8347b04164c42b7acc66a25507ae16c65d402afb\qpid-jms-client-0.3.0.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\org.apache.qpid\proton-j\0.9.1\e580948435ac807aaaa198435b941aa4541fff77\proton-j-0.9.1.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\org.eclipse.paho\org.eclipse.paho.client.mqttv3\1.0.2\e1c9a81aadf25b884c779298a90750d0ab8013a5\org.eclipse.paho.client.mqttv3-1.0.2.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\com.softwareag.ext.org.json\json\0.0.0-20080701\eaa00a63492bdc258bfdbc53f35c21e742c75f8a\json-0.0.0-20080701.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\org.apache.xerces\xercesImpl\2.9.1\7bc7e49ddfe4fb5f193ed37ecc96c12292c8ceb6\xercesImpl-2.9.1.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\org.junit.platform\junit-platform-commons\1.0.0-M3\d5c77e2df6a820ae30fc17f21a3f8cfc03183980\junit-platform-commons-1.0.0-M3.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\org.junit.platform\junit-platform-console\1.0.0-M3\fec4071130bcec4081b868a59fa6cad47f11733\junit-platform-console-1.0.0-M3.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\org.junit.platform\junit-platform-launcher\1.0.0-M3\86525f5274dee56f533f938f9aeae9a3716f8c4\junit-platform-launcher-1.0.0-M3.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\org.junit.platform\junit-platform-runner\1.0.0-M3\21647b5389a01eca650da0a8b9155a3739d4d43d\junit-platform-runner-1.0.0-M3.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\org.junit.platform\junit-platform-gradle-plugin\1.0.0-M3\fa75de7ba58c65a3bf8785f8d49a7a3f6e1d3f52\junit-platform-gradle-plugin-1.0.0-M3.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\org.junit.platform\junit-platform-engine\1.0.0-M3\39a1db55680c9f32985c84ba2951912138b18ac3\junit-platform-engine-1.0.0-M3.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\org.junit.vintage\junit-vintage-engine\4.12.0-M3\d1f572b6d10949cb60e3625e791c8d2da2789882\junit-vintage-engine-4.12.0-M3.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\junit\junit\4.12\2973d150c0dc1fefe998f834810d68f278ea58ec\junit-4.12.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\org.junit.jupiter\junit-jupiter-api\5.0.0-M3\a0f3d812b3f3b394f0f6b1998f706a3685b28cbe\junit-jupiter-api-5.0.0-M3.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\org.junit.jupiter\junit-jupiter-engine\5.0.0-M3\f16a093cdb429dd643638f2f4c617f70568fb3\junit-jupiter-engine-5.0.0-M3.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\com.google.guava\guava\18.0\cce0823396aa693798f8882e64213b1772032b09\guava-18.0.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\org.apache.logging.log4j\log4j-1.2-api\2.6.1\22d989f896b5d6d67cce7e249ccc9cbb89f19e01\log4j-1.2-api-2.6.1.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\org.apache.logging.log4j\log4j-core\2.6.1\2b557bf1023c3a3a0f7f200fafcd7641b89cbb83\log4j-core-2.6.1.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\org.apache.commons\commons-io\2.4.0\b1b6ea3b7e4aa4f492509a4952029cd8e48019ad\commons-io-2.4.0.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\org.hamcrest\hamcrest-core\1.3\42a25dc3219429f0e5d060061f71acb49bf010a0\hamcrest-core-1.3.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\com.hynnet\logback-classic\1.1.3\74cae1a9eb6247a7c1bea6e70556d94d957d8df0\logback-classic-1.1.3.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\ch.qos.logback\logback-core\1.1.3\e3c02049f2dbbc764681b40094ecf0dcbc99b157\logback-core-1.1.3.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\com.google.protobuf\protobuf-java\3.2.0\62ccf171a106ff6791507f2d5364c275f9a3131d\protobuf-java-3.2.0.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\org.slf4j\slf4j-api\1.7.12\8e20852d05222dc286bf1c71d78d0531e177c317\slf4j-api-1.7.12.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\jboss\jbossall-client\4.2.2.GA\3fad87a1e1157ea3d960245692268907077b7ce8\jbossall-client-4.2.2.GA.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\asia.stampy\stampy-all\1.0-RELEASE\e4124c5ad1852aeaae618f46aa755b70d9dbd4f0\stampy-all-1.0-RELEASE.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\com.softwareag.mom.nirvana\nirvana-um-extensions\10.0.0-v90096\8a93d7ae81a14aa5cd9f3f9b172f6a480890a749\nirvana-um-extensions-10.0.0-v90096.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\com.softwareag.mom.nirvana\nirvana-jms-client\10.0.0-v90096\a87b0e036b220d2fd541b3077547183bd884c681\nirvana-jms-client-10.0.0-v90096.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\com.softwareag.mom.nirvana\nirvana-java-client\10.0.0-v90096\e0be844a6e8d5c7f9e0d534d452af6f88951f15d\nirvana-java-client-10.0.0-v90096.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\com.softwareag.mom.nirvana\nirvana-junit-tests\10.0.0-v90096\ec05228b6241e91e1be62988279b509df26584e6\nirvana-junit-tests-10.0.0-v90096.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\com.softwareag.mom.nirvana\nirvana-admin-xml-api\10.0.0-v90096\13b8fa0cdba29acb2a57de2cbb8a3008501a05ee\nirvana-admin-xml-api-10.0.0-v90096.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\com.softwareag.mom.nirvana\nirvana-um-transport\10.0.0-v90096\ebaca5841d674c848fa59e53bc82b771ab759c4f\nirvana-um-transport-10.0.0-v90096.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\com.softwareag.mom.nirvana\nirvana-um-modules\10.0.0-v90096\fe90ac84fc5e430b93011844e01e39afc01fdeb4\nirvana-um-modules-10.0.0-v90096.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\com.softwareag.mom.nirvana\nirvana-admin-api\10.0.0-v90096\edf5b6990e81c1b3591121707ea30becebae666\nirvana-admin-api-10.0.0-v90096.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\com.softwareag.mom.nirvana\nirvana-plugin\10.0.0-v90096\8cfeb82c18540a5c9e38e48594fc19d349f450ec\nirvana-plugin-10.0.0-v90096.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\com.softwareag.mom.nirvana\nirvana-server\10.0.0-v90096\1916d17d97f864030c2d3fdef818fe322be11f5\nirvana-server-10.0.0-v90096.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\org.opentest4j\opentest4j\1.0.0-M1\b091255eafd515995a5c5fa042cd8db6f4860bf6\opentest4j-1.0.0-M1.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\org.apache.logging.log4j\log4j-api\2.6.1\d2ad7ee0b0450204d720b4bc3f99b50e208bf51e\log4j-api-2.6.1.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\com.hynnet\logback-core\1.1.3\de5cb761441a47c9a70e0b088cdea450a368d99\logback-core-1.1.3.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\org.slf4j\slf4j-log4j12\1.7.2\7539c264413b9b1ff9841cd00058c974b7cd1ec9\slf4j-log4j12-1.7.2.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\log4j\log4j\1.2.17\5af35056b4d257e4b64b9e8069c0746e8b08629f\log4j-1.2.17.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\commons-lang\commons-lang\2.6\ce1edb914c94ebc388f086c6827e8bdeec71ac2\commons-lang-2.6.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\commons-codec\commons-codec\1.7\9cd61d269c88f9fb0eb36cea1efcd596ab74772f\commons-codec-1.7.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\io.netty\netty\3.6.2.Final\69be11c61427f0604a30539755add84ad9e37e5e\netty-3.6.2.Final.jar, C:\Users\vatre.gradle\caches\modules-2\files-2.1\org.apache.mina\mina-core\2.0.7\c878e2aa82de748474a624ec3933e4604e446dec\mina-core-2.0.7.jar] Validation unsuccessful for property "name" in project "prod/java/integration-test" with value "prod/java/integration-test"; validation pattern: [a-z][a-z,0-9,-] Validation unsuccessful for property "group" in project "prod/java/integration-test" with value "UniversalMessaging"; validation pattern: [a-z][a-z,0-9,.] Warning: 'file:./config/properties.xml' in C:\BF-5476\prod\java\j2ee\build.xml should be expressed simply as './config/properties.xml' for compliance with other XML tools JBOSS_HOME: C:\BF-5476/test/resource-adapter-testing/jboss-eap-6.1 JAVA 7 distribution found under: C:\Program Files\Java\jdk1.7.0_79 Validation unsuccessful for property "name" in project "test/resource-adapter-testing" with value "test/resource-adapter-testing"; validation pattern: [a-z][a-z,0-9,-] Validation unsuccessful for property "group" in project "test/resource-adapter-testing" with value "UniversalMessaging"; validation pattern: [a-z][a-z,0-9,.] Repository variant not allowed (Only repositories of type IvyArtifactRepository are allowed). Name: 'maven'. Type: BUILDSCRIPT. Class: 'org.gradle.api.internal.artifacts.repositories.DefaultMavenArtifactRepository_Decorated' Repository variant not allowed (Only repositories of type IvyArtifactRepository are allowed). Name: 'mavenCentral'. Type: BUILDSCRIPT. Class: 'org.gradle.api.internal.artifacts.repositories.DefaultMavenArtifactRepository_Decorated' Repository variant not allowed (Only repositories of type IvyArtifactRepository are allowed). Name: 'mavenCentral'. Type: ARTIFACT/REGULAR. Class: 'org.gradle.api.internal.artifacts.repositories.DefaultMavenArtifactRepository_Decorated' Repository variant not allowed (Only repositories of type IvyArtifactRepository are allowed). Name: 'JBoss repository'. Type: ARTIFACT/REGULAR. Class: 'org.gradle.api.internal.artifacts.repositories.DefaultMavenArtifactRepository_Decorated' :prod/java/integration-test:compileJava UP-TO-DATE :prod/java/integration-test:compileGroovy UP-TO-DATE :prod/java/integration-test:processResources UP-TO-DATE :prod/java/integration-test:classes UP-TO-DATE :prod/java/integration-test:compileTestJava UP-TO-DATE :prod/java/integration-test:compileTestGroovy UP-TO-DATE :prod/java/integration-test:processTestResources UP-TO-DATE :prod/java/integration-test:testClasses UP-TO-DATE :prod/java/integration-test:junitPlatformTest UP-TO-DATE :test/resource-adapter-testing:antsetOSConditions :test/resource-adapter-testing:antsetToolWin :test/resource-adapter-testing:antsetToolUnix :test/resource-adapter-testing:antsetToolProperty :test/resource-adapter-testing:antsetS1ASclassPath :test/resource-adapter-testing:antinit-common :test/resource-adapter-testing:antcompile [ant:javac] C:\BF-5476\prod\java\j2ee\build.xml:36: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds warning: [options] bootstrap class path not set in conjunction with -source 1.5 warning: [options] source value 1.5 is obsolete and will be removed in a future release warning: [options] To suppress warnings about obsolete options, use -Xlint:-options. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 3 warnings :test/resource-adapter-testing:antbuild :test/resource-adapter-testing:compileJavawarning: [options] bootstrap class path not set in conjunction with -source 1.7 1 warning

:test/resource-adapter-testing:compileGroovy UP-TO-DATE :test/resource-adapter-testing:processResources UP-TO-DATE :test/resource-adapter-testing:classes :test/resource-adapter-testing:compileTestJava UP-TO-DATE :test/resource-adapter-testing:compileTestGroovy UP-TO-DATE :test/resource-adapter-testing:processTestResources UP-TO-DATE :test/resource-adapter-testing:testClasses UP-TO-DATE :test/resource-adapter-testing:junitPlatformTestFeb 22, 2017 10:48:23 PM org.junit.platform.launcher.core.ServiceLoaderTestEngineRegistry loadTestEngines INFO: No TestEngine implementation discovered. org.junit.platform.commons.util.PreconditionViolationException: Cannot create Launcher without at least one TestEngine; consider adding an engine implementation JAR to the classpath at org.junit.platform.commons.util.Preconditions.condition(Preconditions.java:207) at org.junit.platform.launcher.core.DefaultLauncher.(DefaultLauncher.java:52) at org.junit.platform.launcher.core.LauncherFactory.create(LauncherFactory.java:53) at org.junit.platform.console.tasks.ExecuteTestsTask.executeTests(ExecuteTestsTask.java:61) at org.junit.platform.console.tasks.ExecuteTestsTask.lambda$execute$0(ExecuteTestsTask.java:57) at org.junit.platform.console.tasks.CustomContextClassLoaderExecutor.invoke(CustomContextClassLoaderExecutor.java:33) at org.junit.platform.console.tasks.ExecuteTestsTask.execute(ExecuteTestsTask.java:57) at org.junit.platform.console.tasks.ConsoleTaskExecutor.executeTask(ConsoleTaskExecutor.java:38) at org.junit.platform.console.ConsoleLauncher.execute(ConsoleLauncher.java:54) at org.junit.platform.console.ConsoleLauncher.main(ConsoleLauncher.java:39)

marcphilipp commented 7 years ago

Have you tried adding them to testRuntime instead of externalLibraries directly? If so, we could exclude that potential cause...

Vazzilena commented 7 years ago

Yep, I tried that although I think these configurations extend each other (testRuntime extends testCompile, which on its side extends compile).

I am attaching my setup (build.txt is my build.gradle file, output.txt is the ouput of the 'gradlew build eclipse' command, and gradle.classpath.txt is where I printed the output of the configuration)

gradle.classpath.txt output.txt build.txt

marcphilipp commented 7 years ago

I see that you have set sourceCompatibility and targetCompatibility set to 1.7. However, JUnit 5 requires a Java 8 runtime.

Vazzilena commented 7 years ago

I run this with jre8. The options are set in case you want to run the same code in jre7 (which obviously is not going to happen), but in the run I reported, JDK 8 is being used.

Are you suggesting that the sourceCompatibility and targetCompatibility are causing this?

Vazzilena commented 7 years ago

So, I played around with my project and here is what solved my issues:

1) The sourceCompatibility and targetCompatibility can remain - they have no influence. 2) The explicit testRuntime and testCompile configuration can be removed - since they are explicitly inherited, there is no need to declare them additionally. 3) Removed the application of the plugin (apply plugin: "org.junit.platform.gradle.plugin") from root build gradle file to the inner (sub-project) gradle file, because otherwise, gradle was trying to apply the plugin and run related tasks on the other testing projects and the respective configurations were not declared in those sub-projects.

marcphilipp commented 7 years ago

Great that you were able to solve it!

FabianoLothor commented 5 years ago

I solve it changing

classpath "org.springframework.boot:spring-boot-gradle-plugin:2.1.8.RELEASE"

to

classpath "org.springframework.boot:spring-boot-gradle-plugin:2.2.0.RELEASE"

sormuras commented 5 years ago

Glad you solved it, too.

Always know all dependencies of your ... dependencies. And the frameworks/build tools resolving them.

williambrach commented 4 years ago

Hello! i am getting similar error, when i am trying to execute jUnit test from code.

ERROR - llij.ide.plugins.PluginManager - Cannot create Launcher without at least one TestEngine; consider adding an engine implementation JAR to the classpath 
org.junit.platform.commons.PreconditionViolationException: Cannot create Launcher without at least one TestEngine; consider adding an engine implementation JAR to the classpath
    at testController.MainTestController.runAllTests(MainTestController.java:34)
    at pluginCommunicationHandler.RunTestButton.actionPerformed(RunTestButton.java:14)
    at com.intellij.openapi.actionSystem.ex.ActionUtil$1.run(ActionUtil.java:266)
    at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:283)
    at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.lambda$actionPerformed$0(ActionMenuItem.java:294)
    at com.intellij.openapi.wm.impl.FocusManagerImpl.runOnOwnContext(FocusManagerImpl.java:263)
    at com.intellij.openapi.wm.impl.IdeFocusManagerImpl.runOnOwnContext(IdeFocusManagerImpl.java:77)
    at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.actionPerformed(ActionMenuItem.java:284)
    at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967)
    at com.intellij.openapi.actionSystem.impl.ActionMenuItem.lambda$fireActionPerformed$0(ActionMenuItem.java:112)
    at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:83)
    at com.intellij.openapi.application.TransactionGuardImpl.lambda$submitTransaction$1(TransactionGuardImpl.java:107)
    at com.intellij.openapi.application.TransactionGuardImpl.submitTransaction(TransactionGuardImpl.java:116)
    at com.intellij.openapi.application.TransactionGuard.submitTransaction(TransactionGuard.java:121)
    at com.intellij.openapi.actionSystem.impl.ActionMenuItem.fireActionPerformed(ActionMenuItem.java:112)
    at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308)
    at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
    at java.desktop/javax.swing.JToggleButton$ToggleButtonModel.setPressed(JToggleButton.java:401)
    at java.desktop/javax.swing.AbstractButton.doClick(AbstractButton.java:369)
    at java.desktop/com.apple.laf.ScreenMenuItemCheckbox.itemStateChanged(ScreenMenuItemCheckbox.java:198)
    at java.desktop/java.awt.CheckboxMenuItem.processItemEvent(CheckboxMenuItem.java:396)
    at java.desktop/java.awt.CheckboxMenuItem.processEvent(CheckboxMenuItem.java:364)
    at java.desktop/java.awt.MenuComponent.dispatchEventImpl(MenuComponent.java:375)
    at java.desktop/java.awt.MenuComponent.dispatchEvent(MenuComponent.java:363)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:781)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
    at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:751)
    at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:749)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:748)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:906)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:779)
    at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:422)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:698)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:421)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

Can someone help me? Here is my gradle file

plugins {
    id 'java'
    id 'org.jetbrains.intellij' version '0.4.16'
}

group 'org.example'
version '1.0-SNAPSHOT'

sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

dependencies {
    // https://mvnrepository.com/artifact/org.junit.platform/junit-platform-launcher
    compile group: 'org.junit.platform', name: 'junit-platform-launcher', version: '1.6.0'
    // https://mvnrepository.com/artifact/org.junit.platform/junit-platform-runner
    compile group: 'org.junit.platform', name: 'junit-platform-runner', version: '1.6.0'
    // https://mvnrepository.com/artifact/org.junit.platform/junit-platform-engine
    compile group: 'org.junit.platform', name: 'junit-platform-engine', version: '1.6.0'
    // https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api
    compile group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.6.0'
    // https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-engine
    compile group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.6.0'
}
    test {
        useJUnitPlatform()
    }

// See https://github.com/JetBrains/gradle-intellij-plugin/
intellij {
    version '2019.3'
}
patchPluginXml {
    changeNotes """
      Add change notes here.<br>
      <em>most HTML tags may be used</em>"""
}

Executing code

        LauncherDiscoveryRequest request = LauncherDiscoveryRequestBuilder.request()
                .selectors(
                        //selectPackage("test"),
                        //selectClass(FirstUnitTest.class),
                        selectMethod(UnitTests.class,"whenSomething_thenSomething")
                )
                .build();
        Launcher launcher = LauncherFactory.create(); //MainTestController.java:34 her exception occur
        SummaryGeneratingListener listener = new SummaryGeneratingListener();
        launcher.registerTestExecutionListeners(listener);
        launcher.execute(request);
        TestExecutionSummary summary = listener.getSummary();
        long result = summary.getTestsSucceededCount();
        System.out.println(result);