AxoCover
AxoCover copied to clipboard
Automatically run affected tests on modified code after build
It would be nice to automatically run tests after file was modified and project was build. Since you already have coverage data, if you could only run tests for the files that were modified, it would be very easy and faster.
You can do this already. In the "Tests" tab, right click on a group of tests and click "Cover after each build"
Will it Cover all tests? or only the tests that were covering modified files ?
Right now it covers all tests in the selected group.
To get the functionality you are requesting I think there are a few changes required (btw, I'm just a guy that uses AxoCover, I'm not a contributor or anything)
- Ability to detect tests that are affected by recent changes and run only those tests
- Ability to merge coverage results from a sub-set of tests into an existing coverage report (right now any new coverage, even a sub-set, overwrites the existing report in the UI)
I don't know what's possible or the difficulty level of the required changes
I am currently focusing on stabilizing 1.1, and then I plan to focus on .Net Core.
For this feature I think it is not that much work, but it would take a few days. For best effort/value ratio I would consider the following:
- We can either subscribe to file system events or detect files saves from studio to get a list of modified files.
- For files in test projects we can simply add all tests discovered in the modified file. For files in tested code, we can use the cover by test feature and rerun all tests which go to that file. (For simple implementation let's avoid going into per function detail there as that would require computing diffs, and might not be that much better in results.)
- For merging it is only possible if per test coverage is enabled. However there would be edge cases, as sometimes code is invoked by setup or cleanup code, and that is not included in the test's coverage in OpenCover - so those would either be excluded or included (resulting in either larger or smaller code coverage as intended).
As long as I am working on this tool alone it is going to be somewhat slow, so it will likely need some time to get there. Supporting the different testing frameworks already took much more time then I expected to be. But still I was also having this idea in mind, so at some point I will likely do it, if I have time.