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

Re: [XP] Stubs, Fakes, and Mocks

Expand Messages
  • Steve Howell
    ... I would venture neither. The best way to deepen your understanding of an important topic is to publish your own interpretation of multiple sources and
    Message 1 of 22 , Jan 1, 2008
      --- "J. B. Rainsberger" <jbrains762@...> wrote:
      > Is it a failing of ours as leaders in this arena
      > that so many people
      > find it necessary to re-explain this? or is it
      > merely a consequence of
      > the vastness of the internet?
      >

      I would venture neither. The best way to deepen your
      understanding of an important topic is to publish your
      own interpretation of multiple sources and have it
      reviewed. At least that's what my professors told me.

      Vlad referenced Martin Fowler in the blog FWIW:

      http://vladimirlevin.blogspot.com/2007/11/stubs-fakes-mocks.html




      ____________________________________________________________________________________
      Never miss a thing. Make Yahoo your home page.
      http://www.yahoo.com/r/hs
    • Ron Jeffries
      ... Well, not having read it, we risk the possibility that, at last, someone has explained the topic /well/. I write things, first to understand them, then to
      Message 2 of 22 , Jan 2, 2008
        Hello, J.. On Tuesday, January 1, 2008, at 9:51:56 PM, you wrote:

        > Vlad, please understand me, I haven't read your article, so I'm not
        > judging its quality, but I see one of these every month or so, and I
        > wonder why so many people find it necessary to go over such well-worn
        > ground. I'm not complaining, but rather seeking to understand.

        Well, not having read it, we risk the possibility that, at last,
        someone has explained the topic /well/.

        I write things, first to understand them, then to share them. I
        write things differently all the time in hopes that one of the
        writings will help someone else to gain an understanding they didn't
        previously have.

        Is there a definitive and clear write up of this topic which, if
        only all would read it, would enlighten us all and give us all the
        same understanding? Based on what I have read so far about these
        items, I'd like to know what it is, to read it, and to have everyone
        else read it also.

        But my guess is that the ground may be well worn, but that it is not
        all that well understood by all who tread it.

        Ron Jeffries
        www.XProgramming.com
        Fear is the mindkiller. --Bene Gesserit Litany Against Fear
      • Vlad
        My goal was to explain the differences in a way that I hoped would be as intuitive as possible (i.e. informal and minus pompous language) illustrated with
        Message 3 of 22 , Jan 2, 2008
          My goal was to explain the differences in a way that I hoped would be
          as intuitive as possible (i.e. informal and minus pompous language)
          illustrated with several straightforward but practical examples. I
          have also added the following links to other material on the subject.

          http://en.wikipedia.org/wiki/Mock_object
          href="http://www.c2.com/cgi/wiki?MockObject
          href="http://xunitpatterns.com/Test%20Double.html
          href="http://martinfowler.com/articles/mocksArentStubs.html
          href="http://langrsoft.com/articles/mocking.shtml

          My intent was also to offer my personal sense of when these different
          kinds of test-only objects (aka test-doubles) should and should not be
          used. If somebody offers corrections to my blog entry or additional
          helpful links, I'll happily incorporate them.

          Based on what I was able to find with some searching online, I was
          hoping to fill a small but helpful niche in the mock-objects/tdd
          landscape.

          --- In extremeprogramming@yahoogroups.com, "J. B. Rainsberger"
          <jbrains762@...> wrote:
          > Is it a failing of ours as leaders in this arena that so many people
          > find it necessary to re-explain this? or is it merely a consequence of
          > the vastness of the internet?
        • J. B. Rainsberger
          ... OK. I buy that. Thanks. ... J. B. (Joe) Rainsberger :: http://www.jbrains.ca Your guide to software craftsmanship JUnit Recipes: Practical Methods for
          Message 4 of 22 , Jan 2, 2008
            On Jan 1, 2008, at 21:00 , Steve Howell wrote:
            > --- "J. B. Rainsberger" <jbrains762@...> wrote:
            > > Is it a failing of ours as leaders in this arena
            > > that so many people
            > > find it necessary to re-explain this? or is it
            > > merely a consequence of
            > > the vastness of the internet?
            > >
            >
            > I would venture neither. The best way to deepen your
            > understanding of an important topic is to publish your
            > own interpretation of multiple sources and have it
            > reviewed. At least that's what my professors told me.
            >
            > Vlad referenced Martin Fowler in the blog FWIW:
            >
            > http://vladimirlevin.blogspot.com/2007/11/stubs-fakes-mocks.html
            >
            OK. I buy that. Thanks.
            ----
            J. B. (Joe) Rainsberger :: http://www.jbrains.ca
            Your guide to software craftsmanship
            JUnit Recipes: Practical Methods for Programmer Testing
            2005 Gordon Pask Award for contribution Agile Software Practice
          • J. B. Rainsberger
            ... For sure, I buy that. Thanks. ... J. B. (Joe) Rainsberger :: http://www.jbrains.ca Your guide to software craftsmanship JUnit Recipes: Practical Methods
            Message 5 of 22 , Jan 2, 2008
              On Jan 2, 2008, at 06:46 , Ron Jeffries wrote:
              > But my guess is that the ground may be well worn, but that it is not
              > all that well understood by all who tread it.
              >
              For sure, I buy that. Thanks.
              ----
              J. B. (Joe) Rainsberger :: http://www.jbrains.ca
              Your guide to software craftsmanship
              JUnit Recipes: Practical Methods for Programmer Testing
              2005 Gordon Pask Award for contribution Agile Software Practice
            • Steve Freeman
              ... Well, usually there isn t much to keep since I usually use a framework to do all the work. As a rule I keep the unit tests unless something significant
              Message 6 of 22 , Jan 2, 2008
                On 1 Jan 2008, at 22:08, Steve Howell wrote:
                > Ok, makes sense. In this case, do you tend to use the
                > mocks as scaffolding to be thrown away later, or do
                > you keep the mocks around even after you've gotten
                > around to implementing the "provider" layers (assuming
                > they're reasonably fast)?

                Well, usually there isn't much to "keep" since I usually use a
                framework to do all the work. As a rule I keep the unit tests unless
                something significant changes.

                S.

                Steve Freeman
                http://www.mockobjects.com

                Winner of the Agile Alliance Gordon Pask award 2006
              • J. B. Rainsberger
                ... Thanks for explaining. Don t mind me; I think it s great that so many people want to write about this, but it looks from a distance like a bunch of people
                Message 7 of 22 , Jan 2, 2008
                  On Jan 2, 2008, at 12:59 , Vlad wrote:
                  > My goal was to explain the differences in a way that I hoped would be
                  > as intuitive as possible (i.e. informal and minus pompous language)
                  > illustrated with several straightforward but practical examples. I
                  > have also added the following links to other material on the subject.
                  >
                  > http://en.wikipedia.org/wiki/Mock_object
                  > href="http://www.c2.com/cgi/wiki?MockObject
                  > href="http://xunitpatterns.com/Test%20Double.html
                  > href="http://martinfowler.com/articles/mocksArentStubs.html
                  > href="http://langrsoft.com/articles/mocking.shtml
                  >
                  > My intent was also to offer my personal sense of when these different
                  > kinds of test-only objects (aka test-doubles) should and should not be
                  > used. If somebody offers corrections to my blog entry or additional
                  > helpful links, I'll happily incorporate them.
                  >
                  > Based on what I was able to find with some searching online, I was
                  > hoping to fill a small but helpful niche in the mock-objects/tdd
                  > landscape.
                  >
                  Thanks for explaining. Don't mind me; I think it's great that so many
                  people want to write about this, but it looks from a distance like a
                  bunch of people writing the same thing about the same thing, and that
                  usually makes me wonder why.

                  This also prompts me to write "Stubs aren't mocks", which I've been
                  meaning to do for a few months now. :)

                  Take care.
                  ----
                  J. B. (Joe) Rainsberger :: http://www.jbrains.ca
                  Your guide to software craftsmanship
                  JUnit Recipes: Practical Methods for Programmer Testing
                  2005 Gordon Pask Award for contribution Agile Software Practice
                • Adam Dymitruk
                  ... You should keep your mocks. If you are using a powerful framework like Rhino Mocks, you can specify that what is important for you in that one test. The
                  Message 8 of 22 , Jan 2, 2008
                    > Ok, makes sense. In this case, do you tend to use the
                    > mocks as scaffolding to be thrown away later, or do
                    > you keep the mocks around even after you've gotten
                    > around to implementing the "provider" layers (assuming
                    > they're reasonably fast)?

                    You should keep your mocks. If you are using a powerful framework like
                    Rhino Mocks, you can specify that what is important for you in that
                    one test. The rest is stubbed automatically for you.

                    See the difference between CreateMock and DynamicMock in RhinoMocks.
                    Stubs can be created with one line too. It's actually faster to stub
                    with Rhino Mocks than without.

                    Adam
                  Your message has been successfully submitted and would be delivered to recipients shortly.