Git Product home page Git Product logo

Comments (9)

sbrannen avatar sbrannen commented on September 26, 2024

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.

alixwar avatar alixwar commented on September 26, 2024

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.

sbrannen avatar sbrannen commented on September 26, 2024

@alixwar,

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.

alixwar avatar alixwar commented on September 26, 2024

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.

sbrannen avatar sbrannen commented on September 26, 2024

No worries. Just delete that line. 

from junit5-samples.

alixwar avatar alixwar commented on September 26, 2024

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.

skrugly avatar skrugly commented on September 26, 2024

@alixwar are any solutions found?

from junit5-samples.

alixwar avatar alixwar commented on September 26, 2024

@Adambl4 ,
Unfortunately I haven't found the time yet to investigate this further

from junit5-samples.

sormuras avatar sormuras commented on September 26, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.