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

87240Re: [XP] re: XP, unit testing and accepted failures

Expand Messages
  • yahoogroups@jhrothjr.com
    Dec 31, 2003
      From: "Sean Gilbertson"
      Sent: Wednesday, December 31, 2003 8:16 PM
      Subject: Re: [XP] re: XP, unit testing and accepted failures

      > By handle, for example: I surround a "connect( )"
      > in a try block, and connect throws a
      > "CouldNotConnectException" (or something. In this
      > scenario, the function fails and either propagates
      > the exception or returns something unexpected or
      > unwanted. If you wrote a unit test that ensured that
      > something was received off the socket, that would fail
      > the unit test.

      > - Sean

      I see what you're saying. You're trying to test
      exception handling. The easiest way to do this
      is to mock it out so that you don't call connect()
      directly. You have your own proxy for the
      library calls. Then you can set up the mock to throw
      an exception on the test for whether the exception
      handler works, and to simulate a connection on
      the tests where you want to test that function.

      The last time I had a network project, I did that
      and it cut my test time way down.

      Where this gets messy is, of course, the question
      of whether the mocks are actually modeling the
      live environment properly. For that test, I'd put
      a simulator on the other end of the wire so I could
      force the error conditions I wanted when I wanted

      John Roth
    • Show all 10 messages in this topic