Loading ...
Sorry, an error occurred while loading the content.

Re: [XP] TDD Quandary

Expand Messages
  • Laurent Bossavit
    Erik, ... I would think unit-testing-at-all would be sufficient to catch most of these ? Or is there something else I should know about the kind of DirectX
    Message 1 of 10 , Oct 2, 2004
    • 0 Attachment
      Erik,

      > Ok, to the first question, buggy would be either a) it crashes,

      I would think unit-testing-at-all would be sufficient to catch most
      of these ? Or is there something else I should know about the kind of
      DirectX coding errors, specifically, that make it crash ?

      > b) there are visual artifacts that we don't like.

      Can you recall a specific occasion where you had written code that
      produced a visual artifact, and the code should have been written
      another way ?

      Cheers,

      -[Laurent]-
      The greatest obstacle to transforming the world is that we lack the
      clarity and imagination to conceive that it could be different.
      Roberto Mangabeira Unger
    • J. B. Rainsberger
      ... I might use the Gold Master technique here. Draw the screen and check it by hand once. Now capture it and check future draws against the output you
      Message 2 of 10 , Oct 2, 2004
      • 0 Attachment
        bigbaseballer wrote:

        > How in the world do I test drive graphics (DirectX) code. That is,
        > code that really does very little data manipulation at all, but
        > basically just works with an API to get things done. And by done, I
        > mean drawing objects on the screen. Not something I can really "test"
        > in the sense of having inputs and outputs and verifying them, it is
        > just so complex that the closest thing to traditional unit testing I
        > could do is verify if certain pixels were certain colors ... and I
        > assure you that would be a worthless test.

        I might use the Gold Master technique here. Draw the screen and check it
        by hand once. Now capture it and check future draws against the output
        you verified by hand. If a future draw is different from the Gold
        Master, the test fails. Time to investigate. It's not TDD, but it
        provides a refactoring safety net.

        Another technique is to think of driving the DirectX API as generating a
        sequence of events that a DirectXEventListener catches and sends to the
        API. The techniques for testing event sources and event listeners are
        well documented. (See _JUnit Recipes_, chapter 14.) Now the goal is to
        verify that your code generates the proper set (or sequence) of events,
        the result of which would be a correctly-drawn screen. The set of events
        could be quite big. If it is, then I highly recommend testing this with
        FIT/FitNesse, rather than xUnit.

        I hope this helps.
        --
        J. B. (Joe) Rainsberger
        Diaspar Software Services
        http://www.diasparsoftware.com :: +1 416 791-8603
        Predictable, repeatable, quality delivery
      Your message has been successfully submitted and would be delivered to recipients shortly.