| Order | 4 |
|---|---|
| Area | java |
| TOCTitle | Unit Testing |
| ContentId | 82be3b78-2c09-4571-abec-69f95f111e0f |
| PageTitle | Java Unit Tests in Visual Studio Code |
| DateApproved | 1/2/2019 |
| MetaDescription | See how you can test your Java code in Visual Studio Code. |
| MetaSocialImage |
Testing Java in Visual Studio Code is enabled by the Java Test Runner extension. It's a lightweight extension to run and debug Java test cases. The extension supports the following test frameworks:
- JUnit 4 (v4.8.0+)
- JUnit 5 (v5.1.0+)
- TestNG (v6.8.0+)
The Java Test Runner works with the Language Support for Java by Red Hat and Debugger for Java extensions to provide the following features:
- Run test cases
- Debug test cases
- View test report
- View tests in Test Explorer
Here's a brief session with TestNG:
And with JUnit5:
The JUnit 5 support also covers frequently used annotations such as @DisplayName and @ParameterizedTest
Visit the GitHub repository of the Java Test Runner for more details on commands and settings.
Read on to find out about:
- Debugging - Find out how to debug your Java project with VS Code.
- Java Extensions - Learn about more useful Java extensions for VS Code.



