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

Re: [XP] Testing Leftover

Expand Messages
  • Ron Jeffries
    ... I could imagine in this case that I might just test the private methods, perhaps using the internal accessibility level. However, these three actions
    Message 1 of 42 , Jun 1, 2004
    • 0 Attachment
      On Tuesday, June 1, 2004, at 4:28:44 AM, Ian Collins wrote:

      >>>What about the evolution of the class? Say a class performs a number of
      >>>actions when it is constructed and these are implemented through
      >>>non-trivial private methods. So you write a test for the first method,
      >>>then the next until the startup actions are complete and tested. You
      >>>could just call the constructor, but then you have to dig deeper when
      >>>one of the private methods breaks.
      >>>
      >>>
      >>
      >>This story sounds to me like something going wrong in the design. But I'd
      >>have to see a real example to be sure. A complicated constructor troubles
      >>me, for sure ...
      >>
      >>
      >>
      > OK, a recent example:

      > A class to manage a log split over a group of small files.

      > Test one: make sure the directory containing the logs is created.
      > Test two: test calculation of entries per file and number of files.
      > Test three: locate files (if any) with first and last entries.

      > These where the first three tests written. These are also the first
      > three things the object does when it is created.

      I could imagine in this case that I might just test the private methods,
      perhaps using the "internal" accessibility level.

      However, these three actions don't sound like "log management" to me, they
      sound like some kind of file or directory management. Maybe there's another
      object trying to get out, to be used by the class, rather than be part of
      the class?

      Ron Jeffries
      www.XProgramming.com
      In times of stress, I like to turn to the wisdom of my Portuguese waitress,
      who said: "Olá, meu nome é Marisol e eu serei sua garçonete."
      -- after Mark Vaughn, Autoweek.
    • Phlip
      ... The author of /Working Effectively with Legacy Code/ has reminded us that _in_ sight is better. More team awareness of the difference between the real and
      Message 42 of 42 , Jun 1, 2004
      • 0 Attachment
        Ian Collins wrote:

        > I prefer it shorter, uglier and out of sight!

        The author of /Working Effectively with Legacy Code/
        has reminded us that _in_ sight is better. More team
        awareness of the difference between the real and the
        ideal.


        =====
        Phlip
        http://industrialxp.org/community/bin/view/Main/TestFirstUserInterfaces




        __________________________________
        Do you Yahoo!?
        Friends. Fun. Try the all-new Yahoo! Messenger.
        http://messenger.yahoo.com/
      Your message has been successfully submitted and would be delivered to recipients shortly.