Giter Club home page Giter Club logo

vim-tdd-runner's Introduction

tddrunner.vim

This is a lightweight test runner for Vim. It doesn't try to smart guess what you want to run. It simply runs what you tell it to.

It was evolved through TDD practice in Ruby, but is framework- and language-agnostic.

It has three main features. It allows you:

  1. To mark a test file and run it from any window inside vim.

  2. To apply a filter to run specific test examples of the test file.

    This not only helps you focus on the output of selected test(s), but it can also save time while running it.

  3. To run a test file through different commands.

    Some tests are fast and you wish to run them as independently, others are slower (integration tests) and you wish to run them through a test server. Tdd-runner allows you set multiple key bindings for each method and also knows how to apply the filter to them.

Configuration

Add your preferred key mappings to your .vimrc file and set the commands for running the tests. The following config sets the mappings for rspec:

" Two mappings to run tests independently or via test server:
nmap <leader>t :call tddrunner#RunTest("rspec {file} (-e {filter})")<CR>
nmap <leader>r :call tddrunner#RunTest("rspec --drb {file} (-e {filter})")<CR>

" Key for marking currently open file for test
nmap <leader>m :call tddrunner#SetTestFile()<CR>

" Key for applying or removing regex filter to your tests.
nmap <leader>f :call tddrunner#SetTestFilter()<CR>

Another example for setting two commands for test unit and testdrb:

nmap <leader>t :call tddrunner#RunTest("ruby -Itest {file} (-n /{filter}/)")<CR>
nmap <leader>r :call tddrunner#RunTest("testdrb -Itest {file} (-n /{filter}/)")<CR>

The command string for running tests has a very simple structure and you should be able to customize it to your test framework of choice.

vim-tdd-runner's People

Contributors

hisenb3rg avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.