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

Re: [junit] fundamental questions on JUnit

Expand Messages
  • Vladimir Bossicard
    ... but once you have discovered, you can verify that the class acts the same way over and over again. If you keep your print statements, you re discovering
    Message 1 of 36 , May 1 10:24 AM
    • 0 Attachment
      > I dont think it can replace your print statements
      > because when you are printing, you are <b> discovering
      > </b> rather than <b> verifying </b>.

      but once you have discovered, you can verify that the class acts the
      same way over and over again. If you keep your print statements, you're
      discovering each time your run you tests, which is a lost of time.

      Normally you can predict what a method will do (otherwise it tells you
      something about your comprenhension of the problem you have to solve),
      so if you test your program bit by bit, you should be able to predict
      what it does. Right?

      If you face a challenging toString() method (let's say for a complex
      object), what you can do is first do a println() and then place this
      result into an assertEquals(what_I_got, myObj.toString()). In that
      case, you have first "discovered" the result but then verifying it with
      your tests.

      hth

      -Vladimir

      --
      Vladimir Bossicard
      www.bossicard.com
    • kentlbeck
      ... code ... No it isn t. The goal is a MTBD (Mean Time Between Defects) that doesn t make you unhappy. Kent
      Message 36 of 36 , May 4 3:49 PM
      • 0 Attachment
        --- In junit@y..., Vladimir Bossicard <vladimir@b...> wrote:
        ...
        > I also wanted to remind that the goal is not to have 100% covered
        code
        > but 100% bug-free code.

        No it isn't. The goal is a MTBD (Mean Time Between Defects) that
        doesn't make you unhappy.

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