Re: unit testing Cayenne objects

From: Erik Hatcher (eri..hatchersolutions.com)
Date: Tue May 03 2005 - 11:18:12 EDT

  • Next message: Gentry, Michael \(Contractor\): "RE: Tapestry integration options"

    On May 3, 2005, at 10:12 AM, Cris Daniluk wrote:

    >> That is my setUp method (which you handle with DBUnit), so it's not
    >> testing Cayenne. My unit test is this:
    >>
    >
    > Sorry... I was just trying to make the point that by explicitly
    > creating objects via code, you are creating an unscalable solution
    > (i.e. what if you need 2 or 5 or 25 pieces of data for a test?)

    No question... but what if I only need one piece of data? DBUnit
    would be overkill :)

    I'm pragmatic like that. I'll jam in DBUnit soon though - it seems
    to be the best way to go at this point.

         Erik

    >> I definitely do not want or need to get into testing Cayenne itself,
    >> which is a risk we all take when testing things involving a
    >> framework. My goal is to test my code, and my code only, but that
    >> will indirectly involve Cayenne of course.
    >>
    >>
    >
    > Absolutely. In fact, my unit tests found a fairly esoteric bug in
    > Cayenne a while back that Cayenne's own unit tests did not find. Not
    > at all a bad thing :)

    Excellent!

    I'm a big proponent of Test Driven Learning - writing unit tests to
    get a feel for how a framework or API works. Almost all the examples
    we wrote for Lucene in Action (get the source code at
    www.lucenebook.com) are JUnit tests that assert features of Lucene
    itself.

    And I'm sure that some of the tests I write against my Cayenne model
    will be so that I understand how Cayenne itself works.

         Erik



    This archive was generated by hypermail 2.0.0 : Tue May 03 2005 - 11:18:58 EDT