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

RE: [XP] Re: Test execution speed

Expand Messages
  • Steve Bate
    ... Early in the project we manually wrote mock classes. These were reusable in different situations. Now we use a reflection-based mock implementation that
    Message 1 of 260 , Aug 2, 2004
    • 0 Attachment
      > From: Ron Jeffries [mailto:ronjeffries@...]
      >...
      > Working as JB does, you wind up writing mocks or stubs for every class.
      > Therefore if A's design does change, the changes to use different mocks or
      > stubs might be pretty simple. I can imagine this happening, but my
      > experience suggests that mocks and stubs are pretty specific to their
      > usage, and can also imagine that the ones already built wouldn't be useful
      > in the new situation.

      Early in the project we manually wrote mock classes. These were reusable
      in different situations. Now we use a reflection-based mock implementation
      that eliminates the need to manually write the mock class implementations.
      They are defined, on the fly, based on the interfaces and expected
      interactions.

      >...
      > That has been my practice as well. In fact I stub and mock very rarely. On
      > the other hand, my own programs are small one- or two-person projects. And
      > I agree that there are plenty of ways to keep the tests fast: the main
      > question is whether one values test speed enough to give it attention, I
      > think.

      We rarely seldom give unit test speed much attention. Given the test coding
      guidelines we set up at the start of the project, which have benefits beyond
      test performance, fast execution is a natural side effect. During the last
      few years I can't remember spending any significant time thinking about how
      to optimize unit test speed. On the other hand, the functional tests (no mocks,
      some stubs/simulators) have required significant effort and a relatively complex
      test infrastructure to keep them running reasonably fast.

      Steve
    • Ilja Preuss
      ... Yes, but I thought that we were talking about a test that was wrong. Not sure wether that matters, though... Cheers, Ilja
      Message 260 of 260 , Aug 18, 2004
      • 0 Attachment
        Adrian Howard wrote:
        > On 17 Aug 2004, at 12:22, Ilja Preuss wrote:
        > [snip]
        >> It's certainly the case that without pairing/reviews I am more
        >> likely to
        >> *miss* tests - but I don't think that I get more *wrong* tests that
        >> cancel out with wrong implementation...
        >
        > I think it could happen over time.
        >
        > - Lack of pairing might mean I miss duplication so a bit
        > of business logic gets into foo and bar.
        >
        > - My acceptance test for the business logic only uses foo.
        >
        > - Later I change bar incorrectly, but the foo test still passes.
        >
        > False-pass for that bit of business logic.

        Yes, but I thought that we were talking about a test that was wrong. Not
        sure wether that matters, though...

        Cheers, Ilja
      Your message has been successfully submitted and would be delivered to recipients shortly.