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

RE: [XP] Testing experiences

Expand Messages
  • Arrizza, John
    ... I had a similar situation with code that communicated with a Framework . I derived classes from all the Framework classes that I used. My CUT (code under
    Message 1 of 66 , Aug 1, 2000
    • 0 Attachment
      > -----Original Message-----
      > From: Johannes Brodwall [mailto:johannes@...]

      > * When using a separate layer for database access, I end up in one
      > of two situations: Either the layer does not give realistic enough
      > behavior to enable testing of the upper layers, or the stub database
      > access layer gets to be just as complicated as the real thing!
      I had a similar situation with code that communicated with a "Framework". I
      derived classes from all the Framework classes that I used. My CUT (code
      under test) then was called with the derived classes. I had to rewrite the
      CUT a little to get even that to work!

      Once done though, I had a scheme where the UT would call a method in the
      derived stubs telling the stub what Test I was about to perform. The stub
      would set up some variables in anticipation of whatever calls came next. I
      would then call the UnitTest. The stub would respond with hard coded answers
      to whatever my CUT would then call.

      The pro to this technique is that I got the UT to work at all! The con is
      that I made assumptions about how the Framework worked. In this case, I
      thought that was a small risk.

      > * When testing the chess pieces, I have been setting up miscellaneous
      > configurations for which I know all legal moves. I can then try
      > and move every piece to every square, signaling a broken test if
      > a move should be legal, and it is not; or if a move should not be
      > legal, but it is. This gives a total of up to 32 (pieces) *
      > 64 (squares)
      > = 2048 tests! Even though having so many tests gives me a warm and
      > fuzzy feeling inside, I have a feeling this is overkill.

      Is it possible (and economically justifiable) to write a program to generate
      the 2048 tests?


      > I also feel like I am doing Functional testing when I should be doing
      > Unit Testing. (When) Is the distinction important?
      FT in XP is reserved for verifying that a system statisfies a Story.
      Anything else is a UT. But you're right testing at a Layer level, for
      example, feels more like a FT. In a sense it is, if you are looking at the
      Layer as a kind of "3rd party" library.

      > All in all, I find the "testing mindset" extremely difficult to get
      > into. Is this a common experience for newcomers to XP?
      It is much simpler to do UTs on unwritten code! You've chosen something very
      difficult to do as a first step in XP.

      John Arrizza
    • Mark Wilden
      ... From: Robert C. Martin ... No, I hate you. :) That s a bit too clever (i.e. I m not clever enough!).
      Message 66 of 66 , Aug 14, 2000
      • 0 Attachment
        ----- Original Message -----
        From: "Robert C. Martin" <rmartin@...>
        > >
        > > Sorry to be dense, but what is MT?
        >
        > You're going to hate yourself. MT is an abbreviation for "empty".

        No, I hate you. :) That's a bit too clever (i.e. I'm not clever enough!).
      Your message has been successfully submitted and would be delivered to recipients shortly.