Skip to content
| Marketplace
Sign in
Visual Studio Code>Testing>UnitTest TogglerNew to Visual Studio Code? Get it now.
UnitTest Toggler

UnitTest Toggler

Shuhei Nishikawa

|
19 installs
| (0) | Free
An extension for easy switching between module and unittest files on VSCode
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

UnitTest Toggler

This extension allows you to easily toggle between module files and unittest files in VS Code.
(VSCode上でモジュールファイルとunittestファイルを簡単に切り替えるための拡張機能です。)

Features / How to Use (機能 / 使い方)

(new) Open files in the another editor group

  • Select anotherGroup on new setting openLocation

Easy switching between module files and test files

  • Press Ctrl+Shift+T (macOS: Cmd+Shift+T)
  • Command-palette to Toggle UnitTest
  • Right-click to Toggle UnitTest

Automatic generation of non-existent test files

  • If test-file does not exist, create it!
  • If module-file does not exist, create it!
  • If folder does not exist, create it!

Batch generation of test files for multiple source files

  • Support for various programming languages

Customizable settings to match your project structure

Setting Examples (設定例)

vscode settings(Ctrl + ,)

  1. unittestToggler.affixPosition: Position of the test file affix (default: prefix)
    • prefix: Format like test_sample.py
    • suffix: Format like sample_test.py
  2. unittestToggler.sourceDirectory: Absolute path to your project's source code directory (e.g. /path/to/project/src/main)
  3. unittestToggler.testDirectory: Absolute path to your project's test code directory (e.g. /path/to/project/src/test)
  4. unittestToggler.testFileAffix: Prefix or suffix added to test file names (default: test_)

new (^1.0.1~)

  • anotherGroup: Open files in another editor group if available, or create a new group (default)
  • currentGroup: Open files in the current editor group (previously called "activeGroup")

settings.json

You can add settings like the following to your settings.json:

Python Project Example

{
  "unittestToggler.sourceDirectory": "/path/to/your/project/src",
  "unittestToggler.testDirectory": "/path/to/your/project/tests",
  "unittestToggler.testFileAffix": "test_",
  "unittestToggler.affixPosition": "prefix"
}
  • Source file: /path/to/your/project/src/hoge/huga.py
  • Test file: /path/to/your/project/tests/hoge/test_huga.py

Java Project Example

{
  "unittestToggler.sourceDirectory": "/path/to/your/project/src/main/java",
  "unittestToggler.testDirectory": "/path/to/your/project/src/test/java",
  "unittestToggler.testFileAffix": "Test",
  "unittestToggler.affixPosition": "suffix"
}
  • Source file: /path/to/your/project/src/main/java/com/example/Sample.java
  • Test file: /path/to/your/project/src/test/java/com/example/SampleTest.java

Requirements

  • Visual Studio Code version 1.100.0 or later

ustomization feature

License

MIT

Enjoy TDD!

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft