A Vim plugin in order to open a related test case of a given source file
Vim script
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Vim plugin to open test spec of a source file and viceversa

THIS PLUGIN IS NO LONGER WORKING with vim patch 7.4.260

This plugin opens a related test file of a given source file (and viceversa).

Related Test Screenshot

When you are editing a source file, eg: App.php and you want to open the test file you have to issue tt and the AppTest.php will be opened from your tests folder. If the test file is missing you can create it on the fly.


  • In PHP if you open src/Name/App.php and issue tt the plugin tries to open tests/Name/AppTest.php
  • In Golang if you open boat.go and issue tt the plugin tries to open boat_test.go

... And viceversa! ;-)


You can use Vundle for install this plugin

Bundle 'wdalmut/vim-relatedtest'

Your configuration

You can redefine shortcuts

let g:relatedtest_open_command = '<C-t>'

PHP Filetype configuration

Sometimes you need to set up where sources and tests folders are located, for doing that you can set in your .exrc file for your project.

For example for Symfony2 application you can limit the search operation in your src folder only...

let g:relatedtest_php_src="src/"
let g:relatedtest_php_tests="src/"

In order to exclude always a particular folder like: vendor you can use wildignore flag directly in your .vimrc configuration file.

:set wildignore+=**/vendor/**

Open Strategy

The open strategy comes in help when you want to open the related test in a new window, split, tab etc..

let g:relatedtest_open_strategy = 'vsp'

You can use any vim command as open strategy, the most common are:

  • vsp (open in a vertical split)
  • sp (open in an horizontal split)
  • tabnew (open in a tab)
  • e (open in the current window)