Neovim For Beginners — Test Debugging and Automation

Debug and automate unit tests.

4 min readAug 6, 2022


Neovim For Beginners — Debugging Unit Tests

In this article, we will explore how to debug unit test cases using Neotest,nvim-dap and other plugins. We will also learn how to automate the unit testing when code changes are made.

This article is part 3 of the following articles related to testing.

This article is part of the Neovim for Beginners series.

The Neovim configuration files are available in this repository.

Getting Started

In our existing configuration, we use vim-test, vim-ultest, and Neotest. As vim-ultest is deprecated, we will refactor our configuration and remove vim-ultest.


In the lua/plugins.lua file, we refactor the configuration to install Neotest, vim-test and the test adapters.


We configure the plugins in the lua/config/neotest.lua file.

Which-Key Mappings

In the lua/config/whichkey.lua file, we define the Neotest key mappings.

For debugging, we set the strategy to dap. E.g., we use the following command to debug the last test.

require("neotest").run.run_last({ strategy = "dap" })




Software engineer, Data Science and ML practitioner.