Closed lefticus closed 1 year ago
If you are developing blindly, without any tool guidance, you are doing C++ wrong. Think of these tools like a backup camera in your car. Certainly you can back up without a camera, but having one gives you a second set of eyes, deeper into the action than is possible with your human eyes.
You need:
Continuous build environment
As many compilers as you can
An organized testing framework
test coverage analysis, reporting and tracking (you need to know if your test rate is decreasing!)
As much static analysis as you can (most are free or have free options)
-Wall -Wextra -Wshadow -Wconversion -Wpedantic -Werror
and -W4
on WindowsRuntime analysis during testing
Fuzz Testing
Ship with hardening enabled
See more info about tools and specific compiler options and flags here: https://github.com/cpp-best-practices/cppbestpractices/blob/master/02-Use_the_Tools_Available.md
Using an IDE or plugin for your IDE can help integrate many of these things as well.
Coming in episode 350
Very useful summary @lefticus!
One comment/request for future content... I hope this is an OK to post this: Many (all?) of the testing frameworks mentioned on C++ Weekly as well as numerous online conference presentations, v-blogs, etc. focus primarily on UNIT testing. It would be awesome to learn about some "higher-level testing" frameworks (i.e. component / integration / system) or Best Practices for using these available unit-testing frameworks in a higher-level fashion.
I suggest opening a new issue about "testing beyond unit tests".
Please some practical advice on fuzzing testing for c++ especially with g++(clang++ has its fuzzer lib but g++ does not, g++ is however quite ahead of clang++ on c++20)
I find ut quite promising.
@daixtrose I really like it as well.
For our project, we started using Google Tests. But as we are doing embedded development, at some point we wanted to start running parts of our tests which are between unit tests and functional tests on the actual hardware.
We are using ut to do just that and we are very happy with the results
@lefticus when you say:
As many compilers as you can
Does it make sense to try with different versions of each as well? Or is using the latest version enough?
@lefticus when you say:
As many compilers as you can
Does it make sense to try with different versions of each as well? Or does using the latest version enough?
I would say latest version + whatever version you use for production. Often times that differs because of organizational constraints.
We are in a golden age of C++ tooling, many of them are even free!