How to Use the Testing View and Test Explorer in VS Code

Open and use the VS Code Testing view and Test Explorer to discover, organize, and run tests without leaving the editor. Learn what the beaker icon does and how to set up your first test extension.

6 min read

The Testing view in VS Code is your central hub for everything related to tests. It discovers tests in your project, shows them in a tree, and lets you run, debug, and inspect results without switching to a terminal.

You reach it by clicking the beaker icon in the Activity Bar on the left side of the window. You can also open it from the Command Palette (Ctrl+Shift+P on Windows/Linux, Cmd+Shift+P on macOS) with Testing: Focus on Test Explorer View. There is no default keyboard shortcut, so assign one yourself if you use it often. If you do not see the beaker icon, right-click the Activity Bar and make sure Testing is checked.

Before the Test Explorer shows anything useful, you need one thing: a testing extension.

Install a testing extension

VS Code does not ship with built-in test discovery for most languages. It relies on extensions that know how to find and run tests for a specific framework.

Open the Extensions view (Ctrl+Shift+X on Windows/Linux, Cmd+Shift+X on macOS). Type @category:"testing" in the search box. This filter shows only extensions that add testing support.

The extension you need depends on your language and test framework:

Language / frameworkExtension to install
Python (pytest, unittest)Python extension (includes testing support)
JavaScript / TypeScript (Jest, Mocha, Node.js test runner)Not built in. Install the Jest extension for Jest projects, or search @category:"testing" for an extension that matches your Mocha or Node.js test runner setup.
Java (JUnit, TestNG)Test Runner for Java
GoNot built in by default. The Go extension adds test discovery and Test Explorer support once installed.
C# (xUnit, NUnit, MSTest)C# Dev Kit

Install the extension, then open a project folder that contains tests. The Test Explorer scans your workspace and populates the tree automatically.

If tests do not appear, check the extension documentation. Some frameworks need a configuration file (like pytest.ini or jest.config.js) before discovery works. You can also use the Copilot Chat /setupTests command to get step-by-step help configuring your framework.

Understand the Test Explorer layout

The Test Explorer has three main areas.

The toolbar at the top contains buttons for running all tests, debugging all tests, running with coverage, and refreshing the test list. A filter button (funnel icon) lets you show only failed tests or only tests in the currently open file.

The tree view in the center shows your tests organized by folder, file, and test suite. Each test or group has a play button next to it for running that specific item. The tree mirrors the hierarchical structure of your test code: describe blocks, test classes, and individual test functions all appear as nested nodes.

The status bar at the bottom of the view shows how many tests passed, failed, or were skipped during the last run.

Double-click any test in the tree to jump to its source code. If you double-click a failed test, VS Code opens the file and highlights the failing line.

Run tests from the Test Explorer

Click the play button next to any node to run those tests. You can run:

  • All tests in the project (toolbar play button)
  • All tests in a file (play button next to the file node)
  • All tests in a group or class (play button next to the group node)
  • A single test (play button next to the individual test)

While tests run, a spinner replaces the play button. When the run finishes, the button returns and the node shows its result.

A green check means all tests in that node passed. A red X means at least one test failed.

The test run also updates the editor. Open a test file after a run and look at the left gutter. Each test function shows a small green check or red X. This inline feedback lets you scan a file and spot failures instantly.

Read inline test results

When a test fails, VS Code shows the error message right where you need it. Hover over the red X in the gutter next to the test function. A popup appears with the failure message and a stack trace snippet.

You can also click the Show Output button in the Test Explorer toolbar to open the Test Results panel. This panel shows the full output from the last test run, including console logs and complete error messages. Use the panel when the inline hover message is too short.

The Test Results panel has tabs for each test run. You can compare the output from different runs or keep a failed run open while you fix the code and run again.

VS Code gives you several ways to move between the test tree and your code.

Double-click a test in the explorer to open its file. The cursor lands on the test function, and the function is highlighted briefly.

From the editor, right-click inside a test function and select Run Test or Debug Test. You can also use the gutter play button next to the test definition. This is often faster than finding the test in the tree.

If you have the Test Explorer open, clicking a test in the tree also selects it in the editor, making it easy to see where you are.

Troubleshooting

The beaker icon is missing

Right-click the Activity Bar and make sure Testing has a checkmark. If it is checked but still hidden, your window may be too narrow. Try widening the VS Code window or hiding another Activity Bar item.

No tests appear after installing an extension

First, confirm your project actually contains tests. The Test Explorer only shows files with recognized test functions.

Second, check that your test framework is configured. For Python with pytest, VS Code looks for a pytest.ini or pyproject.toml in your workspace. For Jest, it needs a jest.config.js or a jest entry in your package.json.

Third, click the Refresh Tests button (circular arrow) in the Test Explorer toolbar. Discovery sometimes needs a manual trigger after installing an extension.

Tests show an error saying the test runner is not installed

The extension found your tests but cannot run them because the test framework is missing from your project. Install it with your package manager. For JavaScript: run npm install --save-dev jest in the terminal. For Python: run pip install pytest in your environment.

Once your tests appear in the Test Explorer, you are ready to run and debug them with breakpoints and step controls. To see which lines your tests cover, check out test coverage in VS Code.

Rune AI

Rune AI

Key Insights

  • Open the Testing view by clicking the beaker icon in the Activity Bar, or run Testing: Focus on Test Explorer View from the Command Palette.
  • Install a testing extension first. Go to the Extensions view and filter by @category:"testing" to find one for your framework.
  • The Test Explorer shows all discovered tests in a tree view that mirrors your file structure and test hierarchy.
  • Run a test by clicking the play button next to any test in the tree or in the editor gutter beside the test function.
  • After a test run, the gutter shows a green check (passed) or red X (failed). Hover over the icon to see the error message.
RunePowered by Rune AI

Frequently Asked Questions

Why does the Test Explorer say No tests found?

You likely need a testing extension for your language and framework. Open the Extensions view (Ctrl+Shift+X / Cmd+Shift+X), filter by @category:"testing" and install the extension for your framework. If you already have one, the test framework may need to be configured first. Check the extension documentation for setup steps.

Which testing extensions work with VS Code?

VS Code supports testing through extensions. Popular ones include the Python extension (pytest, unittest), the Jest extension for JavaScript and TypeScript, the Test Runner for Java, the C# Dev Kit, and the Go extension. Search @category:"testing" in the Extensions view to see what is available for your framework.

Can I see test results next to my code?

Yes. After you run tests, the editor gutter shows a green check for passed tests and a red X for failures. Hovering over a failed test shows the error message inline. You can also see test status badges in the editor's overview ruler.

How do I refresh tests after adding new ones?

Click the Refresh Tests button in the Test Explorer toolbar (circular arrow icon), or run the Test Explorer: Reload tests command from the Command Palette (Ctrl+Shift+P / Cmd+Shift+P).

Conclusion

The Testing view gives you a single place to discover, run, and inspect every test in your project. Start by installing the right testing extension for your language, open the Test Explorer with the beaker icon, and let VS Code find your tests automatically. Run a test from the tree, the editor gutter, or the Command Palette. Once you can see your tests in the explorer, you are ready to run and debug them.