Announcement Announcement Module
Collapse
No announcement yet.
iBatis TestCase Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • iBatis TestCase

    I am about to get my feets wet with the iBatis DAO framework. Therefore I need to create test-cases. I would like to use HsqlDB for unit-testing and MySQL and ProstgreSQL for integration testing (acceptence tests are about to run against these DB's).

    My question is, how I should set up the tables? I found it quite fine to derive a scheme from Hibernate's mapping files, but I guess I am out of luck in case of iBatis... . ;-) Since I need to create the tables, I don't want to create the tables by using inlined 'create table' statements.

    So I would like to know, if there is the possiblitly to process SQL scripts or anyother way to ease the task about setting up the test-scenarios?

    Or should I create the tables explicitly to express that the table's are part of the solution by allowing a related 'DAO' to create the required tables? (doesn't make much sence, I guess). I am quite a bit puzzled here.

    How do you do testing of iBatis? What can Spring do for me here?


    Cheers,

    Martin (Kersten)

  • #2
    I would use the org.springframework.test package for integration testing. I would use the production database. I don't see much use for embedded databases in unit testing, because
    - unit tests should test code in isolation, without a database
    - in applications with any complexity of data access, maintaining compatibility two databases is difficult and a waste of effort. (Consider triggers, stored procedures etc.)

    Regarding creating tables, iBATIS is more geared towards working with legacy schemas than Hibernate.

    Comment


    • #3
      I would use the production database.
      I hope you mean "I would use the same kind as the production database"

      Comment


      • #4
        I would use the org.springframework.test package for integration testing.
        I have tried my best but I couldn't located such a package within the 1.2RC pre-release. Are there any concrete classes, I can look for? Did you referred to the test-suite of Spring?


        I would use the production database.
        I will give it a try. Sounds reasonable. I guess I will use a clear table / set sequence approach to avoid creating any tables for the test database... .


        I don't see much use for embedded databases in unit testing.
        I like to unit-test the 'dao' related implementations using something real. Interaction-based testing does not fit my confidence level for db work, I guess.


        Thanks,

        Martin (Kersten)

        Comment


        • #5
          They are part of the mock source tree and distributed in spring-mock.jar

          Comment


          • #6
            Thanks again. ;-) I will take a closer look... .


            Cheers,

            Martin (Kersten)

            Comment

            Working...
            X