Is there a way to run tests of the current opened file and get output in other window like vim-QuickRun does?

Right now I'm running tests by the command in command line:

/vagrant/my_project/app/Console/cake test app Console/Command/FeedParseShell


I'm calling cake command in the project folder by absolute path, because I have several projects on my virtual machine. I'm still not aware how to make vim to know where is the root folder of the project It's currently in. And then I tell CakePHP console what command I want it to run by specifying the option test and write the path to the test file. It looks like this:

/vagrant/my_project/app/Console/cake test app Console/Command/FeedParseShell

(app is not necessary - we can specify the absolute path to the test file without app like:

/vagrant/my_project/app/Console/cake test /vagrant/my_project/app/Test/Case/Console/Command/FeedParseShell


Test files are locatedy in different folders. Here is the structure of Test/Case folder:

Console  Controller  Lib  Model  View  allTest.php
  • 1
    You might be interested in the vim-rooter plugin. – muru Feb 15 '16 at 11:30
  • @muru Thank you very much for your great help. Plugin does work greatly. – whitesiroi Feb 16 '16 at 3:53

I'm not familiar with CakePHP, but you could use :make for it:

set makeprg=/vagrant/my_project/app/Console/cake\ test\ app\ Console/Command/FeedParseShell

Then, if you run :make, the output of this command will be used to populate the quickfix list (which can be useful if the output identifies offending line numbers).

  • Thank you very much for your response & sorry for late acceptance, I was away from my PC for couple days ^^ – whitesiroi Feb 14 '16 at 13:02
  • @whitesiroi No problem. I had a clarification to ask: What does your general /vagrant/my_project/app/Console/cake usage look like? Does it change with the current file, etc.? We could come up with a more general command. – muru Feb 14 '16 at 13:04
  • Thank you very much for your help. I did update my question, so please have a look at it if you have some time. – whitesiroi Feb 15 '16 at 9:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.