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

410Re: [extremeperl] unit tester

Expand Messages
  • Rob Kinyon
    Aug 29, 2005
      On 8/29/05, Rob Nagler <nagler@...> wrote:
      > Rob Kinyon writes:
      > > Please explain more about what you mean "weak on the deviance side". I
      > > tend to test my failure cases using mocked objects and subroutines,
      > > which means the tests are positive tests, not negative ones.
      > I'm not a big fan of Mock objects. I only use them when it's
      > absolutely necessary. I like end-to-end tests, even our unit tests
      > hit the database.

      That is a personal preference. I prefer mocks, because it allows me to
      test in isolation. My theory is that perfect components will work
      together perfectly. It also forces me to work out my APIs a lot
      sooner. This means that I can refactor with confidence.

      > > As for the repetitive nature ... I look at it as the difference
      > > between ASM and Perl. Test::* is ASM, but ASM is very simple to prove
      > > correctness for.
      > I assume you mean Assembler by ASM. I hypothesize the shorter the
      > theory, the easier the proof.

      Unfortunately, that doesn't work out in real life. I have only to
      point to the Riemann Hypothesis. (There is no X^n + Y^n = Z^n, X, Y,
      Z, and n being integers where n > 2.) The proof took 400 years, 300M
      IQ points, and about 200 pages to accomplish.

      > The danger of simple -- as in repetitive -- is that there are more
      > components for the human eye to validate. By programming
      > declaratively, I create complex infrastructure for repetitive tasks,
      > and use them repetitively. If testing were a "one off", I wouldn't do
      > this. However, the Rule of Three applies in spades when it comes to
      > testing, and Perl gives you some extremely powerful tools to eliminate
      > repetition.

      Absolutely. And, I do refactor my tests. However, I focus primarily on
      refactoring my code so that I need fewer tests overall. If I can test
      the same functionality with fewer tests by using cleaner APIs and mock
      objects, isn't that also good?

    • Show all 33 messages in this topic