help. I've fallen. And I can't reach the test button.
- ( via http://assert2.rubyforge.org/
When you edit tests and code, you should have the minimum possible overhead when running a test batch. Ideally, you should edit either tests or code, then hit one
button. (Don't rotate back to a test file, or hit a KeyClaw?
.) The test batch should run in the background, instantly, and should flash green in the corner of your eye. The source code should remain available and unblocked in the editor.
See IncrementalTesting for a fix if your tests run too long (or if you use a stodgy editor that resists streamlining!).
is a technique for doing ZeroButtonTesting
and in Emacs, you can set keys to do background compiles through single keystrokes and point to the errors immediately - in any language with no need to do: file saves, mouse movements, and/or inputs to any console.
Who brung up Vim or Emacs?? I have 1.5 years experience with vi classic. -- PhlIp
We also like the Smalltalk browser types of development environment like ProjectBuilder
I'm not talking about the editors. -- PhlIp
Well, since vim was brung up, I might as well chime in and explain how to implement the above:
Start off with some mappings in your ~/.vimrc. I use F8 as my test key (F8... fate.. get it?)
map <F8> :w<CR>:!./unit-test<CR>
imap <F8> <Esc><F8>
This makes F8 save your buffer and run the "unit-test" command in the current directory. You'll probably want to modify it to do something appropriate for your project (for instance, if the code files are scattered over many directories, I'd recommend making a ~/bin/unit-test which cd's into the correct absolute path and then runs the tests.)
The imap is a further optimization: You don't even have to hit Escape to run the tests. Just bang out some code, hit F8, regardless of what mode you're in, and viola - the tests tell you if you done well.
vim can also do the jump-to-the-failing-line thing (see ":help quickfix" for details), but I find that it gets in my way more than it helps me.
demonstrates the correct method to integrate vith Vim. You...
- map and imap <F5> to save all. I use <F5> because I can get to it with either hand.
- Condition your TestRunner to run the tests when the test suite files or the source files get saved.
- If a compile or test fails and you click on the error line (or Alt+Tab Tab Arrow and Enter on it), TestRunner should tell Vim >6.2 using the --servername --remote and --line options to navigate to that line.
Vim still has major UI bugs, but give them another decade... Or fix it yourself and submit patches. It's what open source is all about. Remember: no code ownership!
Visual Studio.Net users can use the NUnit Add-In
See also: ThreeStrikesAndYouAutomate