Do you want your ad here?

Contact us to get your ad seen by thousands of users every day!

[email protected]

Java Testing with VS Code

  • March 15, 2021
  • 8538 Unique Views
  • 2 min read
Table of Contents

In our last post, we talked about starting a new Java project and running and debugging it with VS Code. In this post, we will cover testing.

To run Java tests on VS Code, we recommend using the Java Test Runner extension or the Java Extension Pack, which includes the extension. The extension supports the JUnit4, JUnit5, and TestNG frameworks.

Running Tests

When a project with test cases is imported into VS Code, VS Code can automatically detect the test cases and get them ready for you to run.

There are a couple of options to run them, as demonstrated below.

Running from Test Explorer

Test Explorer offers the most comprehensive support for testing. In addition to running cases individually, you can Run All Tests, as shown below.

Running from Java Project Explorer

Java Project Explorer provides access to all project-related functionality, including testing. You can run tests at project level or at individual package or class level, as demonstrated below.

Running from CodeLens

CodeLens is a VS Code feature that provides context-aware actions through links next to your code.

When VS Code detects testing annotations in code, it will provide a link of “Run Test” and a link of “Debug Test” next to the annotation for you to quickly start an action without jumping out of your code.

It’s a handy feature that allows you to focus on coding by minimizing context switching.

Accessing Testing Reports

After running tests, VS Code generates a testing report for you.

You can access the report through status bar as shown in demos above or using Command Palette by Ctrl+Shift+P to launch the palette and then typing “java show test report” to open the report.

Until next time, happy coding!

VSCode Java: Roadmap Update and New Features

Welcome to the special mid-year edition for Visual Studio Code Java updates.

As the highlight of this post, we are going to take a look at our product roadmap for the next few months.

We will also showcase some important new features & improvements as we did in previous blog posts.

So let’s get right into it!

Kubernetes Data Simplicity: Getting started with K8ssandra

K8ssandra is an open-source distribution of Apache Cassandra for Kubernetes, with a rich set of trusted open-source services and tooling.

Java Testing with VS Code

In our last post, we talked about starting a new Java project and running and debugging it with VS Code. In this post, we will cover testing.

To run Java tests on VS Code, we recommend using the Java Test Runner extension or the Java Extension Pack, which includes the extension. The extension supports the JUnit4, JUnit5, and TestNG frameworks.

Java Development with VS Code on the Raspberry Pi

Recently we published a full getting started guide for Java with VS Code together with a list of tips and plugins for Java development with Visual Studio Code.

But… did you know you can also use it on the ARM-processor-powered Raspberry Pi?

Until recently this was not available in an official version for the Raspberry Pi, but luckily Microsoft decided to release new versions with installers for both 32-bit and 64-bit Raspberry Pis.

Let’s install and test them!

Do you want your ad here?

Contact us to get your ad seen by thousands of users every day!

[email protected]

Comments (0)

Highlight your code snippets using [code lang="language name"] shortcode. Just insert your code between opening and closing tag: [code lang="java"] code [/code]. Or specify another language.

No comments yet. Be the first.

Subscribe to foojay updates:

https://foojay.io/feed/
Copied to the clipboard