test.vim: running tests the easy way

As we all know, writing tests when developing software is very important¹. Indeed, most modern programming environments have frameworks to write and run tests, sometimes even in the standard tooling: pytest for Python, cargo test for Rust, go test for Go, etc.

Let’s set aside the actual writing of the tests themselves for a moment, and concentrate on running them. Even though these frameworks are easy to run, they all have subtle differences. For one, the command itself to run the tests is different. Specifying which tests we wish to run varies per tool, and so do the arguments that increase verbosity, etc.

If you use vim (or even better neovim 🙂 ) as your IDE, test.vim comes to the rescue by unifying all test frameworks² with very simple commands. For example, when you execute TestNearest, test.vim will locate the test closest to the cursor, and trigger its execution using the appropriate framework. Similarly, TestFile will run all the tests from the current file.

You can use it right away (“zero configuration”), but you can customize some areas if you wish. For example, you can select whether the test results show up on the terminal, in a new window, in a tmux pane, etc. You can also specify different behaviors depending on the language in use.

All in all, test.vim will not revolutionize testing, but it contributes to making it an effortless task. This is especially valuable if you juggle with many projects in diverse programming languages. Give it a try!

— Christian


¹ If you disagree with this, we need to talk 😀

² OK, maybe not all, but the list is very large!