rafanoronha.speaking()

software development stuff

Database Integration Tests – implementing it

without comments

This post is part of a series about Database Integration Tests:

Part 1: Database Integration Tests – considering it
Part 2: Database Integration Tests – understanding it
Part 3: Database Integration Tests – implementing it

In this third and last part of the series, I’m going to demonstrate the implementation of Database Integration Tests.
Below is the representation of the table wich will embrace our testing scenario:

erd_customer

Then you have the source code of a simple java implementation upon the usage of junit and dbunit frameworks.

The relevant piece of code is inside the class CustomerIntegrationTest.
At the method
setup(), we ask dbunit to clean the customers table and then insert some new customers as input data for the first test.

At the second test, we ask dbunit to look for the created customer in the database and compare it with the existing on in the xml file.

I’ll leave preferedCustomers.xml and newCustomer.xml as a homework for you, if you intend to hack with this implementation.

By the way, this is the end of the series.
Hope you enjoyed!


Help me to spread the word!
  • Digg
  • del.icio.us
  • RSS
  • DotNetKicks
  • Technorati
  • Twitter
  • FriendFeed

Related posts:

  1. Database Integration Tests – understanding it
  2. Database Integration Tests – considering it
  3. (Portuguese) Teste dedo-duro
  4. Model validation specifications
  5. (Portuguese) Testando a engine de blog com BDD

Written by rafanoronha

June 8th, 2010 at 12:10 am

Posted in Sem categoria

Tagged with ,

Leave a Reply