microsoft / microsoft/vscode-java-test

Java Test Runner not recording any test output

Open
#1,772 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

ai-triaged bug gradle investigating junit test-discovery test-execution
Dominant language
TypeScript
Stars
340
Forks
173
Avg merge
1d 19h
Merged PRs (30d)
18

Description

When I first try to execute all JUnit tests, I receive this on the Debug Console:

Image

Image

After cleaning the Gradle project with "./gradlew clean build --refresh-dependencies" and trying to run the tests again, it tells me that my build has failed.

Here is my current build.gradle.kts file:

plugins {
    // Apply the application plugin to add support for building a CLI application in Java.
    id("java")
    application
    id("org.openjfx.javafxplugin") version "0.1.0"
}

repositories {
    // Use Maven Central for resolving dependencies.
    mavenCentral()
}

dependencies {
    // Use JUnit Jupiter for testing.
    testImplementation(platform("org.junit:junit-bom:5.10.0"))
    testImplementation("org.junit.jupiter:junit-jupiter")
    // https://mvnrepository.com/artifact/org.mockito/mockito-core
    testImplementation("org.mockito:mockito-junit-jupiter:5.15.+")
}

// Apply a specific Java toolchain to ease working on different environments.
java {
    toolchain {
        languageVersion = JavaLanguageVersion.of(21)
    }
    sourceSets {
        named("main") {
            java {
                setSrcDirs(listOf("src/main/java"))
            }
        }
    }
}

javafx {
    version = "21.0.6"
    modules("javafx.controls", "javafx.fxml")
}

application {
    // Define the main class for the application.
    mainClass = "main"
}

tasks.named<Test>("test") {
    // Use JUnit Platform for unit tests.
    useJUnitPlatform()
}

I tried reloading my project, cleaning java language workspace etc. nothing seemed to change anything.
Important to note is that on a completely different cloned repository with the same gradle configurations, everything works fine.

Would appreciate any help with this, otherwise I'll stick to IntelliJ with the testing.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The report points to the Java Test Runner and the project's build.gradle.kts, with JUnit tests invoked through Gradle. Start by reproducing the test run and reviewing the Debug Console and Gradle build output; done means identifying why this project records no test output and restoring successful test execution.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, typescript
Domain
testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.