Open Thunderforge opened 4 years ago
Absolutely agree with this. It's something that should be addressed sooner rather than later. I'll take a look at them, and get back to here with what I feel we should go with. Any stand out to you personally?
While I have no experience with C++ unit test frameworks (I mostly develop in other languages where other tools are used), I'm definitely drawn to the article's description of Google Test:
Google Test is the most well-known cross-platform test runner for C++. It's distributed as source code. So, you have to build it for your environment or include it as a vendor dependency with CMake. It comes with a mocking library and, unlike Microsoft's runner, is open-source software.
Assuming the claim of being "most well-known" is true, that would mean it has the largest pool of developers who are already familiar with it. I see it's an xUnit framework, so it should have little to no learning curve for developers familiar with similar frameworks on other platforms (e.g. JUnit on Java). I also like that it's cross-platform & open source, and that it includes a mocking framework already. Plus, the project's GitHub page says it's used for the LLVM compiler, and if it's used for that, then it should certainly be good enough for our purposes (and more importantly, it should continue to be maintained for the foreseeable future).
The downside is that it has to be built from source code or bundled via CMake or a similar packaging tool, but I think we're going to have to go down one of those routes either way with any unit testing framework we choose.
Google Test looks good, and the requirement of switching to CMake is not a deal breaker for me. I've not really had much experience with writing CMake files personally, but I've used them plenty of times.
Same here in terms of testing C++. I've never really worked with unit testing C++, so this is a new venture for me. Most of my experience in unit testing has been with ObjC and Swift.
Whatever is done in KDK I'll mirror into Kestrel.
Is your feature request related to a problem? Please describe.
Say that a PR was submitted. Right now, there is no way of verifying that the code will work properly, or that it won't break existing features, without having a user exhaustively test every scenario of the app. Such manual verification is time-consuming, and as a result is likely to be avoided. Therefore, there's a high possibility that any code may introduce bugs or break existing functionality.
Describe the solution you'd like
Unit tests are an essential tool to ensuring the stability of a project. With it, we can ensure that new changes don't break existing functionality, and have confidence that our code will run correctly on end user machines.
Kestrel SDK is still a fairly small project, so by writing unit tests now, we can set a precedent for future work and avoid having to add a lot at a future date (in other words, we are preventing "tech debt" at a later time).
Describe alternatives you've considered
The alternative would be to not write unit tests at all, which is the current situation in which we have the problem described above.
Additional context
This article provides an excellent overview of unit testing in C++, including a comparison of various testing frameworks. I do not have a particular recommendation of one framework over another.