Comments (9)
The existing sample application is only intended to demonstrate how to use the JUnit Platform Gradle plugin in general.
All of the sample applications assume the user knows how to use the features of his or her build tool of choice. Thus, we intentionally keep the samples simple and concise. Consequently, there is no real benefit in making the existing sample application more complex than necessary.
I have therefore changed the title of your proposal, and we will consider introducing a more complex sample application.
from junit5-samples.
I think that it is important to showcase an appropriate configuration for a parent project (no dependency exists to the libraries). What I see is this error:
:junitPlatformTest
Could not load Logmanager "org.apache.logging.log4j.jul.LogManager"
java.lang.ClassNotFoundException: org.apache.logging.log4j.jul.LogManager
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.util.logging.LogManager$1.run(LogManager.java:195)
at java.util.logging.LogManager$1.run(LogManager.java:181)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.logging.LogManager.<clinit>(LogManager.java:181)
at java.util.logging.Logger.demandLogger(Logger.java:448)
at java.util.logging.Logger.getLogger(Logger.java:502)
at org.junit.platform.launcher.core.DefaultLauncher.<clinit>(DefaultLauncher.java:41)
at org.junit.platform.launcher.core.LauncherFactory.create(LauncherFactory.java:42)
at org.junit.platform.console.tasks.ExecuteTestsTask.executeTests(ExecuteTestsTask.java:56)
at org.junit.platform.console.tasks.ExecuteTestsTask.lambda$execute$1(ExecuteTestsTask.java:52)
at org.junit.platform.console.tasks.CustomContextClassLoaderExecutor.invoke(CustomContextClassLoaderExecutor.java:33)
at org.junit.platform.console.tasks.ExecuteTestsTask.execute(ExecuteTestsTask.java:52)
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)
Jul 29, 2016 4:13:21 PM org.junit.platform.launcher.core.ServiceLoaderTestEngineRegistry loadTestEngines
INFO: Discovered TestEngines with IDs: []
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:161)
at org.junit.platform.launcher.core.DefaultLauncher.<init>(DefaultLauncher.java:52)
at org.junit.platform.launcher.core.LauncherFactory.create(LauncherFactory.java:42)
at org.junit.platform.console.tasks.ExecuteTestsTask.executeTests(ExecuteTestsTask.java:56)
at org.junit.platform.console.tasks.ExecuteTestsTask.lambda$execute$1(ExecuteTestsTask.java:52)
at org.junit.platform.console.tasks.CustomContextClassLoaderExecutor.invoke(CustomContextClassLoaderExecutor.java:33)
at org.junit.platform.console.tasks.ExecuteTestsTask.execute(ExecuteTestsTask.java:52)
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)
from junit5-samples.
Can you please let us know if adding the following to build.gradle
for your root project solves the issues you're facing?
ext.junit4Version = '4.12'
ext.junitVintageVersion = '4.12.0-M2'
ext.junitPlatformVersion = '1.0.0-M2'
ext.junitJupiterVersion = '5.0.0-M2'
ext.log4jVersion = '2.6.2'
allprojects {
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.junit.platform.gradle.plugin'
repositories {
mavenCentral()
}
compileTestJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
options.compilerArgs += '-parameters'
}
dependencies {
// JUnit Jupiter API and TestEngine implementation
testCompile("org.junit.jupiter:junit-jupiter-api:${junitJupiterVersion}")
testRuntime("org.junit.jupiter:junit-jupiter-engine:${junitJupiterVersion}")
// If you also want to support JUnit 3 and JUnit 4 tests
testCompile("junit:junit:${junit4Version}")
testRuntime("org.junit.vintage:junit-vintage-engine:${junitVintageVersion}")
testRuntime("org.apache.logging.log4j:log4j-core:${log4jVersion}")
testRuntime("org.apache.logging.log4j:log4j-jul:${log4jVersion}")
}
}
from junit5-samples.
Unfortunately, I get this error:
The 'java' plugin has been applied, but it is not compatible with the Android plugins.
The culprit is the line: apply plugin: 'java'
from junit5-samples.
No worries. Just delete that line.
from junit5-samples.
Then I see this:
Could not find method testCompile() for arguments [org.junit.jupiter:junit-jupiter-api:5.0.0-M2] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
from junit5-samples.
@alixwar are any solutions found?
from junit5-samples.
@Adambl4 ,
Unfortunately I haven't found the time yet to investigate this further
from junit5-samples.
With native JUnit Platform test support introduced in Gradle 4.6 you should be able to follow the default Gradle way to layout, configure, build and test multi-module projects.
Closing this issue.
from junit5-samples.
Related Issues (20)
- Consider moving to a public domain licence HOT 5
- Please cite best practice for not excluding maven-wrapper.jar HOT 4
- Use Apache Ivy in Ant examples
- Upgradle to 6.0.1 HOT 1
- Help | Is there any way I can add @Tags dynamically from Test Data HOT 1
- Use HTTPS
- Add Android integration test project HOT 1
- Issue with JUnit after finishing Level 10 HOT 1
- build.gradle.kts and tag expressions HOT 2
- How to use TestPipeline HOT 3
- 5.7.1 breaks Bazel sample HOT 13
- DisplayName tag not working properly in junit5-jupiter-starter-maven example HOT 4
- Add module-info.java to have an example that works with Jigsaw too. HOT 1
- Add `junit5-jupiter-starter-graalvm-native` sample HOT 5
- Build broken when using kotlin 1.7.21 HOT 4
- Update used GitHub Actions HOT 2
- Bazel starter issues a deprecation warning HOT 4
- junit5-jupiter-starter-gradle @ParameterizedTest name not displaying HOT 2
- Groovy HOT 2
- Intellij IDE shows 'no name' for a kotlin-bazel project HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from junit5-samples.