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

Re: [XP] MockObjects (was RE: Perform unit testing with EasyMock (fwd))

Expand Messages
  • Steve Freeman
    From: Jonathan Rasmusson ... Actually, I ve just been through a spate of retrofitting and have found mocks very useful, particularly
    Message 1 of 58 , Nov 6, 2002
    • 0 Attachment
      From: "Jonathan Rasmusson" <rasmus4200@...>
      > Gotcha. One problem I have faced on client projects is retro fitting
      > unit tests into code that was not written test first. The first step
      > is usually convincing the developers that testing is a good thing.
      > Once that is done, they start writing tests using high level
      > objects.
      >
      > Because the code has not been written test first, it can be difficult
      > to insert a mock into certain places. That combined with an over
      > agressive use of inheritance can create some challenges unit test
      > scenarios. Challenging in inserting a mock, and challenging to keep
      > the tests running fast.

      Actually, I've just been through a spate of retrofitting and have found
      mocks very useful, particularly for working with bloated classes. For
      example, I can replace singletons with an object that's passed through and
      then fake that up. I can extract an internal object to implement some of the
      contents of the huge methods, then pass that through, then substitute a
      fake. etc, etc. On our team, we've found it an effective technique for
      poking around inside a class without significantly changing the external
      interface.

      S.

      - - - - - - - - - - - - - - -
      Steve Freeman steve@...
      Programme chair OT2003. http://www.ot2003.org

      "Nonsense is just nonsense, but the study of nonsense is science."
    • Steve Freeman
      From: Jonathan Rasmusson ... Actually, I ve just been through a spate of retrofitting and have found mocks very useful, particularly
      Message 58 of 58 , Nov 6, 2002
      • 0 Attachment
        From: "Jonathan Rasmusson" <rasmus4200@...>
        > Gotcha. One problem I have faced on client projects is retro fitting
        > unit tests into code that was not written test first. The first step
        > is usually convincing the developers that testing is a good thing.
        > Once that is done, they start writing tests using high level
        > objects.
        >
        > Because the code has not been written test first, it can be difficult
        > to insert a mock into certain places. That combined with an over
        > agressive use of inheritance can create some challenges unit test
        > scenarios. Challenging in inserting a mock, and challenging to keep
        > the tests running fast.

        Actually, I've just been through a spate of retrofitting and have found
        mocks very useful, particularly for working with bloated classes. For
        example, I can replace singletons with an object that's passed through and
        then fake that up. I can extract an internal object to implement some of the
        contents of the huge methods, then pass that through, then substitute a
        fake. etc, etc. On our team, we've found it an effective technique for
        poking around inside a class without significantly changing the external
        interface.

        S.

        - - - - - - - - - - - - - - -
        Steve Freeman steve@...
        Programme chair OT2003. http://www.ot2003.org

        "Nonsense is just nonsense, but the study of nonsense is science."
      Your message has been successfully submitted and would be delivered to recipients shortly.