Code coverage in Win32 app
We are just about to start a new project. The Proof of Concept (PoC) for this project was done simply using Win32. The plan is/was to flesh out the PoC, tidy the uglier parts and meet the requirements set by the project owners.
One of the requirements for the actual project is 100% code coverage but I can see problems ahead: How can I acheive 100% code coverage with Win32 - the message pump will be exceptionally difficult to test effectively?! I could compile to a DLL but won't there be code in the main app that won't be under coverage?
I am thinking of dropping the Win32 code and moving to MFC - at least then a lot of the boiler plate stuff will be hidden from view (and therefore coverage).
Any thoughts o开发者_如何转开发n the problem?
I mean WndProc, but the same applies for WinMain. How can you unit-test that?
I do testing but not unit-testing: I do system/integration testing.
If you exercise your (whole) application while it's running under a debugger/profiler/code coverage analyser, then of course you will find (and the coverage analyser will show) that WinMain etc. are being run (are being covered).
The question then might be, how do you automate the system/integration testing of the whole application? You might have a test framework with automates driving the GUI; I don't know of any myself, but for example there's a list here. Alternatively, it might be acceptable (to the client) if the acceptance test suite is a sequence of non-automated/manual tests.
See also Should one test internal implementation, or only test public behaviour?
精彩评论