What are the most modern unit testing approaches for C ++? A class of languages โโwith a greater ability for introspection (for example, Python) has unit testing modules that are more natural to use. Unit tests can be defined more easily. In comparison, the classic CppUnit (based on JUnit ) seems to take a very conservative approach. Is there something new and better that uses a certain power of C ++ (or even C ++ 11) to make life easier?
I used the CppUnit for some time quite simplified for parts of the project in my native C ++ Windows (Visual Studio 2005 and 2010). Previously, we did not choose a testing-based approach, because there was already a lot of outdated code, and it was difficult for us to add tests for it. We had to reorganize the application, but adding all the good tests would take a lot of time even in this case.
We recently switched to Visual Studio 2013 (due to the standard implementation of C ++ 11), and we are going to start a new, rather long-term project.
Having previous good (small) experience with unit testing, I would like to try the Test Driven Development approach. Since the project is not tiny (the expected size is about the same as the older one, i.e. about 200 thousand lines of code), I prefer a lighter (but no less workable) structure.
The new project is likely to lead to cross-platform implementation (Windows and Linux). Visual Studio 2013 has support for unit testing, but I have no experience working with it and how it will fit the cross-platform platform.
So far I have found a list of unit testing modules for C ++ . However, it is impossible to understand how they differ in principle. I currently have three candidates (conservative choice):
- Boost - a likely candidate; test for C ++ standards; therefore, it is likely that it will be widely accepted; probably the largest user group. It seems to be more advanced than
CppUnit . - CppUnit - I know this, but writing all the code around is not a pleasure.
- Visual Studio 2013 is built-in - new to me, somehow it can generate skeletons, probably.
In any case, it seems that all three take a similar approach. VS2013 may support code generation, but this does not mean that it leads to anything simpler.
Is there a radically new approach?
c ++ cross-platform unit-testing visual-studio visual-studio-2013
pepr Dec 16 '13 at 8:58 2013-12-16 08:58
source share