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

Re: [XP] Does C++ unit testing become easier ?

Expand Messages
  • John A. De Goes
    I personally don t encourage heavy use of strong mocking frameworks because they permit even the worst design to be tested simply. That s generally not a good
    Message 1 of 4 , Dec 1, 2006
      I personally don't encourage heavy use of strong mocking frameworks
      because they permit even the worst design to be tested simply. That's
      generally not a good thing, because it allows a developer to forego
      TDD and play catch up later, writing tests to whatever monstrosity she
      has created.

      Mocking is principally useful when trying to get legacy code under
      automated tests. If you are doing TDD, you'll seldom need more than a
      few test objects at critical junctions in the application. And for
      doing TDD, none can surpass UnitTest++, which is quite simply the best
      unit testing framework for C++.

      Anyway, to address your original question, there's simply no good
      solution that doesn't involve preprocessing the code or using
      debugging information.

      Regards,

      John


      Quoting Steven Woody <narkewoody@...>:

      > how may c++ guys there? for unit testing, i think object mocking
      > tools is a must. but mockpp is a daunting tool to use. is there any
      > bettern choice today?
      >
      > thanks.
      >
      > --
      > woody
      >
      > then sun rose thinly from the sea and the old man could see the other
      > boats, low on the water and well in toward the shore, spread out
      > across the current.
      >
    • Anthony Williams
      ... I ve just uploaded a blog entry on the topic of mock usage to my website:
      Message 2 of 4 , Dec 4, 2006
        "Steven Woody" <narkewoody@...> writes:

        > how may c++ guys there? for unit testing, i think object mocking
        > tools is a must. but mockpp is a daunting tool to use. is there any
        > bettern choice today?

        I've just uploaded a blog entry on the topic of mock usage to my website:

        http://www.justsoftwaresolutions.co.uk/tdd/mocks_stubs_fakes_and_interaction-based_testing.html

        I think this is particularly relevant, since I mainly work in C++. Quick
        summary: I use quite a few dummy implementations, mainly "self shunt", but not
        full blown "Mock Objects", and certainly not any object mocking tools or
        frameworks. I use them to help separate responsibilities, and particularly
        when the concrete implementation that I'm replacing would need to talk to
        external systems, whether that is a database, a file, external hardware, or
        something over the network.

        Anthony
        --
        Anthony Williams
        Software Developer
        Just Software Solutions Ltd
        http://www.justsoftwaresolutions.co.uk
      • Steven Woody
        ... thank you for sharing your site. thanks!
        Message 3 of 4 , Dec 4, 2006
          On 12/4/06, Anthony Williams <anthony_w.geo@...> wrote:
          >
          >
          >
          >
          >
          >
          > "Steven Woody" <narkewoody@...> writes:
          >
          > > how may c++ guys there? for unit testing, i think object mocking
          > > tools is a must. but mockpp is a daunting tool to use. is there any
          > > bettern choice today?
          >
          > I've just uploaded a blog entry on the topic of mock usage to my website:
          >
          > http://www.justsoftwaresolutions.co.uk/tdd/mocks_stubs_fakes_and_interaction-based_testing.html
          >
          > I think this is particularly relevant, since I mainly work in C++. Quick
          > summary: I use quite a few dummy implementations, mainly "self shunt", but not
          > full blown "Mock Objects", and certainly not any object mocking tools or
          > frameworks. I use them to help separate responsibilities, and particularly
          > when the concrete implementation that I'm replacing would need to talk to
          > external systems, whether that is a database, a file, external hardware, or
          > something over the network.
          >

          thank you for sharing your site. thanks!
        Your message has been successfully submitted and would be delivered to recipients shortly.