views:

68

answers:

1

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 on the problem?

A: 

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?

ChrisW
I used to work at a place that used Mercury WinRunner for automated testing but not here. Also I need to check whether DevPartner will still collect information outside of the dev enviroment.
graham.reeds
@graham.reeds -- Another way to automate testing might be to 'instrument' (add extra code to) your application: so that it logs input events (mouse and keyboard), and can subsequently 'play back' what it captured (re-inject the logged input events).
ChrisW
Games from Within called that 'Le Chimp'. Again, since we don't own the code, the client will need 100% coverage on that. Since this is a short 8 week cycle we don't really have that luxery.
graham.reeds
@graham.reeds -- Thank you for the [LeChimp](http://gamesfromwithin.com/lechimp-vs-dr-chaos) reference: I'd forgotten about the idea of using semi-random input for testing.
ChrisW