From a520e332255186df6ec288b24ca32762aa101799 Mon Sep 17 00:00:00 2001 From: gregvanl Date: Tue, 30 Nov 2021 16:31:48 -0800 Subject: [PATCH] Formatting pass on recent updates --- blogs/2017/09/28/java-debug.md | 8 ++--- docs/java/extensions.md | 2 +- docs/java/java-faq.md | 2 +- docs/java/java-testing.md | 58 +++++++++++++++++++++------------- docs/java/java-tutorial.md | 2 +- docs/languages/java.md | 4 +-- release-notes/v1_59.md | 2 +- 7 files changed, 45 insertions(+), 33 deletions(-) diff --git a/blogs/2017/09/28/java-debug.md b/blogs/2017/09/28/java-debug.md index 7f9847719..075b4bd15 100644 --- a/blogs/2017/09/28/java-debug.md +++ b/blogs/2017/09/28/java-debug.md @@ -11,13 +11,11 @@ Author: Xiaokai He September 28, 2017 Xiaokai He -For Java developers on Visual Studio Code, the [Language Support for Java™ by Red Hat](https://marketplace.visualstudio.com/items?itemName=redhat.java) extension has been great for providing language features such as IntelliSense and project support. At the same time, we've also heard feedback that users would also like Java debugging. Today, we're excited to announce our ongoing collaboration with Red Hat and enabling Java developers to debug Java applications with a new lightweight [Java Debugger for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-debug) based on [Java Debug Server](https://github.com/microsoft/java-debug). +For Java developers on Visual Studio Code, the [Language Support for Java™ by Red Hat](https://marketplace.visualstudio.com/items?itemName=redhat.java) extension has been great for providing language features such as IntelliSense and project support. At the same time, we've also heard feedback that users would also like Java debugging. Today, we're excited to announce our ongoing collaboration with Red Hat and enabling Java developers to debug Java applications with a new lightweight [Debugger for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-debug) based on [Java Debug Server](https://github.com/microsoft/java-debug). ![Java debug extension](java-debug-extension.png) ->**Note**: Both the **Java Debugger for Visual Studio Code** and **Java Debug Server** will be open sourced shortly after the initial release. - -To help Java developers to get started with VS Code quickly, we also created an [Extension Pack for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack) which includes both the [Language Support for Java™ by Red Hat](https://marketplace.visualstudio.com/items?itemName=redhat.java) and [Java Debugger for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-debug) extensions so you won't need to search for them individually. This is just the start to creating a modern workflow for Java and we'll be adding more features and extensions to the **Extension Pack for Java** in the future. +To help Java developers to get started with VS Code quickly, we also created an [Extension Pack for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack) which includes both the [Language Support for Java™ by Red Hat](https://marketplace.visualstudio.com/items?itemName=redhat.java) and [Debugger for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-debug) extensions so you won't need to search for them individually. This is just the start to creating a modern workflow for Java and we'll be adding more features and extensions to the **Extension Pack for Java** in the future. ## Getting started @@ -25,7 +23,7 @@ To get started: 1. In Visual Studio Code, open the **Extensions** view (`kb(workbench.view.extensions)`). 2. Type "java" to filter the list. -3. Find and install the [Extension Pack for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack) or standalone [Java Debugger for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-debug) extension if you already have [Language Support for Java™ by Red Hat](https://marketplace.visualstudio.com/items?itemName=redhat.java) installed. +3. Find and install the [Extension Pack for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack) or standalone [Debugger for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-debug) extension if you already have [Language Support for Java™ by Red Hat](https://marketplace.visualstudio.com/items?itemName=redhat.java) installed. You also install the **Extension Pack for Java** directly from this blog post: diff --git a/docs/java/extensions.md b/docs/java/extensions.md index d131e3b67..ac0438f32 100644 --- a/docs/java/extensions.md +++ b/docs/java/extensions.md @@ -26,7 +26,7 @@ To help set up Java on VS Code, there is the Microsoft [Extension Pack for Java] 1. [Language Support for Java™ by Red Hat](https://marketplace.visualstudio.com/items?itemName=redhat.java) 2. [Debugger for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-debug) -3. [Java Test Runner](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-test) +3. [Test Runner for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-test) 4. [Maven for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-maven) 5. [Project Manager for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-dependency) 6. [Visual Studio IntelliCode](https://marketplace.visualstudio.com/items?itemName=VisualStudioExptTeam.vscodeintellicode) diff --git a/docs/java/java-faq.md b/docs/java/java-faq.md index 5de9d5499..a3c861f4f 100644 --- a/docs/java/java-faq.md +++ b/docs/java/java-faq.md @@ -87,7 +87,7 @@ Currently we don't plan to extend the Java support to Visual Studio. There are a ## Does VS Code Java support other display languages? -Currently we support Chinese in addition to English for a few extensions including [Debugger for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-debug), [Java Test Runner](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-test), [Maven for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-maven), [Project Manager for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-dependency). To learn how to switch the VS Code display language, see [Display Languages](/docs/getstarted/locales.md). +Currently we support Chinese in addition to English for a few extensions including [Debugger for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-debug), [Test Runner for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-test), [Maven for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-maven), [Project Manager for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-dependency). To learn how to switch the VS Code display language, see [Display Languages](/docs/getstarted/locales.md). You can contribute to the extension repositories if you're interested in additional display language support. diff --git a/docs/java/java-testing.md b/docs/java/java-testing.md index 0c90915a1..0dab64ff8 100644 --- a/docs/java/java-testing.md +++ b/docs/java/java-testing.md @@ -4,7 +4,7 @@ Area: java TOCTitle: Testing ContentId: 82be3b78-2c09-4571-abec-69f95f111e0f PageTitle: Java Unit Tests in Visual Studio Code -DateApproved: 9/1/2021 +DateApproved: 11/30/2021 MetaDescription: See how you can test your Java code in Visual Studio Code. MetaSocialImage: --- @@ -34,14 +34,16 @@ The [Test Runner for Java](https://marketplace.visualstudio.com/items?itemName=v - Visual Studio Code (version 1.59.0 or later) - [Extension Pack for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack) - Install the Extension Pack for Java ## Project Setup -(If you have already setup your Java test framework in your project, you can skip to the [Features](#features) section.) + +**Note**: If you have already setup your Java test framework in your project, you can skip to the [Features](#features) section. ### JUnit 4 + #### Maven + Add following configuration into your `pom.xml`: ```xml @@ -54,6 +56,7 @@ Add following configuration into your `pom.xml`: ``` #### Gradle + Make sure following lines are added in your `build.gradle`: ```groovy @@ -66,22 +69,27 @@ dependencies { } ``` -#### Unmanaged Folder -If your project does not use any build tools. You need to download the following JARs and add them to the project classpath (via setting `java.project.referencedLibraries`, check [Library Configuration](/docs/java/java-project.md#library-configuration) for more information): +#### Unmanaged folder + +If your project does not use any build tools, download the following JARs and add them to the project classpath (via setting `java.project.referencedLibraries`, check [Library Configuration](/docs/java/java-project.md#library-configuration) for more information): - [junit.jar](https://search.maven.org/search?q=g:junit%20AND%20a:junit) - [hamcrest-core.jar](https://search.maven.org/artifact/org.hamcrest/hamcrest-core/1.3/jar) -> You can check the [official wiki](https://github.com/junit-team/junit4/wiki/Download-and-Install) for more information about how to setup JUnit 4. +> You can check the [official JUnit wiki](https://github.com/junit-team/junit4/wiki/Download-and-Install) for more information about how to setup JUnit 4. ### JUnit 5 + The JUnit 5 team provides a collection of sample projects with different build tools. Check the [junit5-sample repository](https://github.com/junit-team/junit5-samples) if your project uses Maven or Gradle as your build tool. -#### Unmanaged Folder +#### Unmanaged folder + If your project does not use any build tools, for simplicity, you can directly include the [junit-platform-console-standalone](https://repo1.maven.org/maven2/org/junit/platform/junit-platform-console-standalone/) JAR in the project classpath (via setting `java.project.referencedLibraries`, check [Library Configuration](/docs/java/java-project.md#library-configuration) for more information). ### TestNG + #### Maven + Add following configuration into your `pom.xml`: ```xml @@ -94,6 +102,7 @@ Add following configuration into your `pom.xml`: ``` #### Gradle + Make sure following lines are added in your `build.gradle`: ```groovy @@ -106,8 +115,9 @@ dependencies { } ``` -#### Unmanaged Folder -If your project does not use any build tools. You need to download the following JARs and add them to the project classpath (via setting `java.project.referencedLibraries`, check [Library Configuration](/docs/java/java-project.md#library-configuration) for more information): +#### Unmanaged folder + +If your project does not use any build tools, download the following JARs and add them to the project classpath (via setting `java.project.referencedLibraries`, check [Library Configuration](/docs/java/java-project.md#library-configuration) for more information): - [testng.jar](https://search.maven.org/search?q=g:org.testng%20AND%20a:testng) - [jcommander.jar](https://search.maven.org/artifact/com.beust/jcommander/1.81/jar) @@ -116,13 +126,13 @@ If your project does not use any build tools. You need to download the following ### 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, click the green play button. You can also right-click on it to see more options. +The Test Runner for Java extension will generate shortcuts (the green play button) on the left side of the class and method definition. To run the target test cases, click the green play button. You can also right-click on it to see more options. ![Run/Debug Test Cases](images/java-testing/editor-decoration.png) ### Test Explorer -The Test Explorer is a tree view to show all the test cases in your workspace. You can click the beaker-like button on the left-side activity bar of Visual Studio Code to open it. You can also run/debug your test cases and view their test results from there. +The Test Explorer is a tree view to show all the test cases in your workspace. You can click the beaker button on the left-side Activity bar of Visual Studio Code to open it. You can also run/debug your test cases and view their test results from there. ![Test Explorer](images/java-testing/test_explorer.png) @@ -133,20 +143,22 @@ Sometimes you may want to customize the configuration to run your test cases. To ![Customize test configurations](images/java-testing/configuration.png) Currently the supported configurations are: -- **args**: Specify the command line arguments which will be passed to the test runner. + +- **args**: Specify the command-line arguments that will be passed to the test runner. - **classPaths**: The classpaths defined in this setting will be appended to the resolved classpaths. - **env**: Specify the extra environment variables when running the tests via a key-value object. - **envFile**: Specify the absolute path to a file containing environment variable definitions. - **modulePaths**: The modulepaths defined in this setting will be appended to the resolved modulepaths. -- **name**: Specify the name of the configuration item. You can set the default configuration name via setting `java.test.defaultConfig` -- **preLaunchTask**: Specify the label of a task specified in tasks.json (in the workspace's .vscode folder). The task will be launched before the start of testing -- **sourcePaths**: Specify the extra source paths when debugging the tests -- **vmArgs**: Specify the extra options and system properties for the JVM -- **workingDirectory**: Specify the working directory when running the tests +- **name**: Specify the name of the configuration item. You can set the default configuration name via setting `java.test.defaultConfig`. +- **preLaunchTask**: Specify the label of a task specified in `tasks.json` (in the workspace's `.vscode` folder). The task will be launched before the start of testing. +- **sourcePaths**: Specify the extra source paths when debugging the tests. +- **vmArgs**: Specify the extra options and system properties for the JVM. +- **workingDirectory**: Specify the working directory when running the tests. More details can be found on the [vscode-java-test Wiki](https://github.com/Microsoft/vscode-java-test/wiki/Run-with-Configuration). ### View test results + After running/debugging the test cases, the state of the related test items will be updated in both editor decorations and the Test Explorer. ![View test results](images/java-testing/test_report.png) @@ -154,26 +166,28 @@ After running/debugging the test cases, the state of the related test items will You can trigger the command **Test: Peek Output** to peek the results view. You can select the links in the stack trace to navigate to the source location. ### Generate tests -The extension provides features to help you scaffold test cases. You can find the entry in the editor context menu. Select `Source Action...` and then choose `Generate Tests...`. -If you trigger this source action from your main source code (test subject), you will be asked the test class's fully qualified name and the methods you want to test, the extension will generate the test code for you: +The extension provides features to help you scaffold test cases. You can find the entry in the editor context menu. Select **Source Action...** and then choose **Generate Tests...**. + +If you trigger this source action from your main source code (test subject), you will be asked the test class's fully qualified name and the methods you want to test. The extension will then generate the test code for you: -If you trigger it from your test source code, you will be asked which kinds of test methods you want to add. Including the lifecycle methods and the test method: +If you trigger the source action from your test source code, you will be asked which kinds of test methods you want to add. Including the lifecycle methods and the test method: ### Test navigation -The extension provides features to help you navigate between your tests and test subjects. If your source code is contained in `src/main/java` or `src/test/java`, you can find the entry named `Go to Test` or `Go to Test Subject` in the editor context menu: + +The extension provides features to help you navigate between your tests and test subjects. If your source code is contained in `src/main/java` or `src/test/java`, you can find the entry named **Go to Test** or **Go to Test Subject** in the editor context menu: ![Go to tests](images/java-testing/goto-test.png) -You can also find the command in the Command Palette (`kb(workbench.action.showCommands)`) by searching `>Java: Go to Test` +You can also find the command in the Command Palette (`kb(workbench.action.showCommands)`) by searching for **Java: Go to Test**. ### VS Code testing commands diff --git a/docs/java/java-tutorial.md b/docs/java/java-tutorial.md index 85934d716..6c9166435 100644 --- a/docs/java/java-tutorial.md +++ b/docs/java/java-tutorial.md @@ -34,7 +34,7 @@ If you are an existing VS Code user, you can also add Java support by installing * [Language Support for Java™ by Red Hat](https://marketplace.visualstudio.com/items?itemName=redhat.java) * [Debugger for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-debug) -* [Java Test Runner](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-test) +* [Test Runner for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-test) * [Maven for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-maven) * [Project Manager for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-dependency) * [Visual Studio IntelliCode](https://marketplace.visualstudio.com/items?itemName=VisualStudioExptTeam.vscodeintellicode) diff --git a/docs/languages/java.md b/docs/languages/java.md index 54806cc46..cc755813a 100644 --- a/docs/languages/java.md +++ b/docs/languages/java.md @@ -40,7 +40,7 @@ If you have already installed VS Code and want to add Java support to it, we rec 1. [Language Support for Java™ by Red Hat](https://marketplace.visualstudio.com/items?itemName=redhat.java) 2. [Debugger for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-debug) -3. [Java Test Runner](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-test) +3. [Test Runner for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-test) 4. [Maven for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-maven) 5. [Project Manager for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-dependency) 6. [Visual Studio IntelliCode](https://marketplace.visualstudio.com/items?itemName=VisualStudioExptTeam.vscodeintellicode) @@ -155,7 +155,7 @@ Although it's lightweight, the Java debugger supports advanced features such as ## Testing -With the support from the [Java Test Runner](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-test) extension, you can easily run, debug, and manage your JUnit and TestNG test cases. +With the support from the [Test Runner for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-test) extension, you can easily run, debug, and manage your JUnit and TestNG test cases.