Looking for a correct way to set up my project to apply TDD. I need a test runner, mocking framework and coverage report to do this properly. Some things I have already figured out but it takes a lot of time that I'd be happy to spend writing application code.
Is there an example project out there with 100% code coverage?
I try to move my project from C to some modern programming language. The project has unit tests in C. But creating mocks manually is tedious and slows development down. https://github.com/mem-memov/net/tree/master/graph
At work I use PHP 7.2 and PHPUnit framework which is a great tool. I had an idea that something like this should exist for Nim or D.
You can look into the unittest module
I'm not really using TDD, but I try to always have a test for general and edge cases every time I had a new public proc or type in Arraymancer.
The runners are done in the nimble file with CI on Nim devel and latest table for Linux, Mac and Windows. This includes serial, parallel, OpenCL, Cuda, stability and probabilistic tests.
I don't need that much mocking because I'm favoring a stateless approach.
For comprehensive tests with mocking, you can check Nimbus and the corresponding JSON tests. The tests are for a blockchain virtual machine. Basically we setup a VM, load the current state from the JSON files, execute the next transaction, and verify that the end state is as expected.
In short with have either proc, templates or macros that setup the VM mocking with the fixtures in a JSON file.
Both Arraymancer and Nimbus use and extend the unittest module for their specific use-case.