Skip to content

VS Code does not recognize junit tests #1692

@siddhsql

Description

@siddhsql

I am following the steps at this page to run Junit5 tests with VS Code and Maven. I have these extensions installed:

image image image

and my pom.xml has:

<dependency>
    <groupId>org.junit.jupiter</groupId>
    <artifactId>junit-jupiter</artifactId>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>org.junit.platform</groupId>
    <artifactId>junit-platform-launcher</artifactId>    
    <scope>test</scope>
</dependency>        

I have put my test classes in src/test/java. but VS Code does not detect JUNIT5 tests. the green "lenses" or "buttons" do not show up next to the tests. In one of the logs I could see:

Preview features enabled at an invalid source release level 21, preview can be enabled only at source level 22; code: 2098258
image

and not sure if it is because of this.

related: #470

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions