问题
I am using Google Test 1.7.0 in NetBeans IDE 7.3.1 on a Microsoft Windows 7 operating system together with Minimalist GNU for Windows. To make test cases run from inside the IDE, I followed this YouTube video.
Everything works fine, but running (more exactly building) the tests is horribly slow.
To conclude:
- I've build Google Test and Google Mock as a static library. Both are not rebuilt on running the tests.
- Both static libraries are linked for the test files only and together with POSIX Threads (
-lpthreads
).
The duration to compile and run eight test files is at least one minute for a project in which I am also linking Crypto++. This seems to be the major bottleneck, but the building of tests in a separated project (without a static library dependency) is also slow.
Therefore I have the following three questions:
- General: Is the described build time "normal" for testing in C++, or is there something wrong with my environment? I am coming from a dynamic programming language background, and imho the long test/implement cycles are not acceptable. TDD is more or less useless with these long build times.
- NetBeans IDE related: Even if I select one test folder (with one test file) in NetBeans IDE and run the tests via the context menu for that folder, all existing tests for the project are rebuilt. In addition every test file is always rebuild, no matter if there have been any changes or not. Is it possible to change that behaviour in NetBeans IDE? Or do I have to run the tests explicitly via the CLI then?
- With respect to the other two questions: What is, in your opinion, the fastest and most efficient way to run automated tests for C++?
I know that C++ code must be compiled in contrast to other languages (e. g. Ruby or PHP - both use an interpreter) and therefore do understand the generally lower test/implement cycle times.
来源:https://stackoverflow.com/questions/20348336/improving-the-build-times-for-google-test-test-cases-in-netbeans-ide