Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Run and debug Java test cases in Visual Studio Code.

License

NotificationsYou must be signed in to change notification settings

microsoft/vscode-java-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Run and debug Java test cases in Visual Studio Code

Overview

A lightweight extension to run and debug Java test cases in Visual Studio Code. The extension support following test frameworks:

  • JUnit 4 (v4.8.0+)
  • JUnit 5 (v5.1.0+)
  • TestNG (v6.9.13.3+)

Note: JUnit 3 styled tests are not supported in this extension (i.e. extendsjunit.framework.TestCase).

TheTest Runner for Java works withLanguage Support for Java by Red Hat andDebugger for Java to provide the following features:

  • Run/Debug test cases
  • Customize test configurations
  • View test report
  • View tests in Test Explorer

Requirements

Features

Run/Debug Test Cases

Run/Debug Test Cases

  • The extension will generate shortcuts (the green play button) on the left side of the class and method definition. To run the target test cases, simply click on the green play button. You can also right click on it to see more options.

Test Explorer

Test Explorer

  • The Test Explorer is the place to show all the test cases in your workspace. You can also run/debug your test cases from here.

Customize Test Configurations

Customize Test Configurations

  • Sometimes you may want to customize the configuration to run your test cases. To achieve this, you can add the configuration into your workspace settings under the section:java.test.config.

Note: More details can be foundhere.


View Test Result

View Test Result

  • After running/debugging the test cases, the state of the related test items will be updated in both editor decoration and test explorer.
  • You can trigger the commandTest: Peek Output to peek the result view.
  • You can click on the links in the stack trace to navigate to the source location.

VS Code Embedded Commands for Testing

VS Code Embedded Commands for Testing

There are other VS Code embedded commands for testing, which can be found by searchingTest: in the Command Palette.

Settings

Setting NameDescriptionDefault Value
java.test.configSpecify the configuration for the test cases to run with.More details.{}
java.test.defaultConfigSpecify the name of the default test configuration.""

VS Code Embedded Settings for Testing

VS Code Embedded Settings for Testing

There are some other VS Code embedded settings for testing, which can be found by searchingtesting in the Settings view.

Project Setup

JUnit 5

Please refer toGetting Started from the JUnit 5's official document for getting started documentation.

Note: If your project does not use build tools(Maven/Gradle/...), please make surejunit-platform-console-standalone.jar is on your project classpath.

JUnit 4

Please refer toDownload and Install from the JUnit 4's official document for the getting started documentation.

TestNG

Please refer toTestNG Docs from the TestNG's official document for getting started documentation.

FAQ

If you meet any problem when using the extension, please refer to theFAQ and ourissue list to check if there is an answer to your problem.

Contributing and Feedback

If you are interested in providing feedback or contributing directly to the code base, please check the documentContributing to Test Runner for Java, which covers the following parts:

License

This extension is licensed underMIT License.

Telemetry

This extension collects telemetry data to help improve our products. Please readMicrosoft privacy statement to learn more. If you opt out to send telemetry data to Microsoft, please set below configuration in settings.json:telemetry.enableTelemetry = false. Learn more in ourFAQ.


[8]ページ先頭

©2009-2025 Movatter.jp