Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I effectively test against the Windows API?
    primarykey
    data
    text
    <p>I'm still having issues justifying TDD to myself. As I have mentioned in other questions, 90% of the code I write does absolutely nothing but</p> <ol> <li>Call some Windows API functions and</li> <li>Print out the data returned from said functions.</li> </ol> <p>The time spent coming up with the fake data that the code needs to process under TDD is incredible -- I literally spend 5 times as much time coming up with the example data as I would spend just writing application code.</p> <p>Part of this problem is that often I'm programming against APIs with which I have little experience, which forces me to write small applications that show me how the real API behaves so that I can write effective fakes/mocks on top of that API. Writing implementation first is the opposite of TDD, but in this case it is unavoidable: I do not know how the real API behaves, so how on earth am I going to be able to create a fake implementation of the API without playing with it?</p> <p>I have read several books on the subject, including Kent Beck's Test Driven Development, By Example, and Michael Feathers' Working Effectively with Legacy Code, which seem to be gospel for TDD fanatics. Feathers' book comes close in the way it describes breaking out dependencies, but even then, the examples provided have one thing in common:</p> <ul> <li>The program under test obtains input from other parts of the program under test.</li> </ul> <p>My programs do not follow that pattern. Instead, the only input to the program itself is the system upon which it runs.</p> <p>How can one effectively employ TDD on such a project? I'm already wrapping most of the API inside C++ classes before I actually use that API, but sometimes the <a href="https://stackoverflow.com/questions/2531874/how-might-i-wrap-the-findxfile-style-apis-to-the-stl-style-iterator-pattern-in-c">wrappers themselves can become quite complicated</a>, and deserve their own tests.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload