ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Test Switcher

by davidmreed ST3

A Sublime Text extension to move between source and test files easily.

Labels testing

Details

Installs

  • Total 13
  • Win 5
  • OS X 5
  • Linux 3
Jul 20 Jul 19 Jul 18 Jul 17 Jul 16 Jul 15 Jul 14 Jul 13 Jul 12 Jul 11 Jul 10 Jul 9 Jul 8 Jul 7 Jul 6 Jul 5 Jul 4 Jul 3 Jul 2 Jul 1 Jun 30 Jun 29 Jun 28 Jun 27 Jun 26 Jun 25 Jun 24 Jun 23 Jun 22 Jun 21 Jun 20 Jun 19 Jun 18 Jun 17 Jun 16 Jun 15 Jun 14 Jun 13 Jun 12 Jun 11 Jun 10 Jun 9 Jun 8 Jun 7 Jun 6
Windows 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
OS X 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Linux 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

Test Switcher for Sublime Text

© 2017 David Reed, distributed under the MIT License.

This plugin provides a configurable way to swap between source files and corresponding test classes in Sublime Text 3. Invoke it while viewing a source file to tab to the corresponding test file, or vice versa, by choosing Test Switcher from the command palette or pressing Control-Shift-Insert (Linux and Windows) or Command-Shift-\ (Mac). Test Switcher scans open tabs first for matching files and then walks the directory tree for your open folders.

The plugin can be configured to find tests using many different naming conventions. It matches on basename (file name minus extension) as well as on extension. To configure basename matching, in the plugin's settings, supply a list for prefixes and suffixes. These will be added to the source file base name to locate possible test class files, and will be matched against the head and tail of open files to locate the source files corresponding to tests. The default configuration looks for prefixes ["test", "test_"] and suffixes ["test", "_test", ".spec"]. Hence, a source file named Base.py would match to a test file named TestBase.py, Test_Base.py, Base_test.py, BaseTest.py, or Base.spec.py, and vice versa. Note that matching is case-insensitive on all platforms.

You may also, if you choose, supply test_extensions and source_extensions. If present, only test and source files who match according to the defined name rubric and possess an extension in the relevant list will be offered as an option. If the lists are blank or empty, extensions are ignored.