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

87225[XP] re: XP, unit testing and accepted failures

Expand Messages
  • John Brewer
    Dec 31, 2003
      > I'm just getting into XP and unit testing, and I like what I see
      >(particularly the book "Agile Software Development"), however I have a
      >question: How does unit testing view acceptable failures, such as a
      >class being unable to connect to a remote host? I can tell that some
      >things are assumed to work (i.e., not running out of memory), but how
      >far does this extend? Should I make judgement calls? I have some
      >reservations about assuming disk writes will go as planned, and I'm
      >hesitant to the point of immobility to accept that network connections
      >will be peachy.

      For unit tests, you want to isolate the class under test, and control
      its environment completely. The usual way to do this is to abstract
      out interfaces for the classes the class under test. Then you can
      plug in a so-called "mock object" that implements that interface, but
      fakes the implementation. Then you can have your mock object either
      work or as needed, so you can test your class's behavior in both

      For acceptance tests and overall system tests, I'd treat the systems
      inability to deal with a network or disk space failure as a system
      failure. I'd probably also get together with a suitably sadistic QA
      person, and figure out how to repeatably cause such a network or disk
      failure, so that we could test the system's response to the situation
      via an automated test suite.

      John Brewer
      Jera Design

      Extreme Programming FAQ: http://www.jera.com/techinfo/xpfaq.html
    • Show all 10 messages in this topic