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

Re: [XP] Testing Leftover

Expand Messages
  • Douglas Philips
    ... Its a holiday, so I m not colocated with my library, but I seem to recall Kent Beck addresses this very issue in Test-Driven Design. Probably also
    Message 1 of 48 , Jun 1, 2004
      On Jun 1, 2004, at 2:33 AM, Lior Fridman wrote:
      > BTW I did do it TDD. I had the test there before I started coding, and
      > somehow the need to access private data structures seemed very natural
      > to me. I still think it's the only sure way to check that a method
      > performed its operation in the right way without depending on other
      > methods from the class to work properly.

      Its a holiday, so I'm not colocated with my library, but I seem to
      recall Kent Beck addresses this very issue in Test-Driven Design.
      Probably also addressed in at least one of the XP books, though I can't
      recall. Perhaps someone else can chime in, but my recollection without
      having TDD to consult, is that he advocated creating a log (perhaps
      just a string that you concatenate to), if you need to trace that the
      right things are happening in the right order. I've used this technique
      a lot. Sometimes I log just the function names, sometimes parameters
      and results, though that often isn't necessary (i.e. I can transmute my
      fear into boredom with just the function names being logged).

      <D\'gou
    • J. B. Rainsberger
      ... If A behaves correctly, and if testing B with a real A is painful, then consider mocking A when testing B. Simple. -- J. B. Rainsberger, Diaspar Software
      Message 48 of 48 , Jun 2, 2004
        Lior Fridman wrote:

        > But I want to test class B and not A
        >
        > I know that A behaves correctly (it has its own tests)
        >
        > So I don't think that replacing B with a mock class willl help me test
        > class B.

        If A behaves correctly, and if testing B with a real A is painful, then
        consider mocking A when testing B. Simple.
        --
        J. B. Rainsberger,
        Diaspar Software Services
        http://www.diasparsoftware.com :: +1 416 791-8603
        Let's write software that people understand
      Your message has been successfully submitted and would be delivered to recipients shortly.