Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1092403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:40:37+00:00 2026-05-16T23:40:37+00:00

I have heard that when developing application which uses a database you should do

  • 0

I have heard that when developing application which uses a database you should do database unit testing.

What are the best practices in database unit testing? What are the primary concerns when doing DB unit testing and how to do it "right"?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T23:40:38+00:00Added an answer on May 16, 2026 at 11:40 pm

    What are the best practices in database unit testing?

    The DbUnit framework (a testing framework allowing to put a database in a know state and to perform assertion against its content) has a page listing database testing best practices that, to my experience, are true.

    What are the primary concerns when doing db unit testing

    • Creating an up to date schema, managing schema changes
    • Setting up data (reference data, test data) and maintaining test data
    • Keeping tests independent
    • Allowing developers to work concurrently
    • Speed (tests involving database are typically slower and will make your whole build take more time)

    and how to do it “right”?

    As hinted, follow known good practices and use dedicated tools/frameworks:

    • Prefer in memory database if possible (for speed)
    • Use one schema per developer is a must (to allow concurrent work)
    • Use a “database migration” tool (à la RoR) to manage schema changes and update a schema to the ultimate version
    • Build or use a test harness allowing to put the database in a known state before each test and to perform asserts against the data after the execution (or to run tests inside a transaction that you rollback at the end of the test).
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have heard that prepared statements with SQLite should improve performance. I wrote some
I have heard that MbUnit comes with pretty nice test decorators which allow writing
I am developing an application which at the moment queries a (rather large) database
I am developing an Android application that uses OpenGL to render a 3D ball
I am developing an application which uses an xmlrpc service to communicate. I developed
I'm developing an Eclipse RCP application. I have been told that the UI part
I'm currently developing a camera application for Android on which some problems have occurred.
I have heard that when dealing with mutexes, the necessary memory barriers are handled
I have heard that in C++, using an accessor ( get...() ) in a
I have heard that web-based chat clients tend to use networking frameworks such as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.