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 157741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T10:33:29+00:00 2026-05-11T10:33:29+00:00

Most things I read about Unit Tests is about testing your classes and their

  • 0

Most things I read about Unit Tests is about testing your classes and their behaviour. But how do you test saving data to a database and reading data from a database. In our project saving and reading data is done through services that are used by a Flex Application (using WebORB as a gateway). For instance, a service reads all users that have access to a certain module. How do you test that the users that are being returned actually are the users having access to that module?

Sometimes being able to test loading data out of database requires that there’s data already in the database. In some of our tests we first need to save a lot of testdata to the database before being able to test reading stuff…

The same thing is valid for Stored Procedures. How do you test sp’s if there’s no data in the database. Reality is that to test certain stored procedures, we need data in ten tables…

thx, Lieven Cardoen

  • 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. 2026-05-11T10:33:29+00:00Added an answer on May 11, 2026 at 10:33 am

    You can have tests for db actions, but try to avoid it if possible, otherwise:

    • They will run slower than ordinary tests (more likely they are integration tests)
    • They require more setup/teardown work (db/schema/table data)
    • They introduce an external dependency on your test framework

    It may also be a code smell that your classes are not separating db related work from other work, e.g. business logic. However it may not, we have a framework test which verifies that the automatically generated SQL script returns the expected incremented identity value after inserting new data, AFAIK there is no way to test that this code is working other than to execute it against the db. You could mock it out or just assume that if the SQL matches what you expect then it’s ok, but I don’t like that assumption since so much other code relies on it.

    Depending on your test framework, you should mark these tests as [Database] related, allowing you to separate them from other tests.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 70k
  • Answers 70k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer You might find the open source Datejs library to be… May 11, 2026 at 12:53 pm
  • added an answer For an array that small ( if you want the… May 11, 2026 at 12:53 pm
  • added an answer Well, to get some data over HTTP protocol in iPhone,… May 11, 2026 at 12:53 pm

Related Questions

One of the things I miss the most in ActionScript is the lack of
I've got a menu that contains, among other things, some most-recently-used file paths. The
I'm currently evaluating CodeRush and one thing that I liked most when reading the
I have a solid understanding of most OOP theory but the one thing that
What are the most common things to test in a new site? For instance
Our client wants us to build a web-based, rich internet application for gathering software
I have long been of the opinion that the time and resources it would
I want to spruce up some areas of my website with a few jQuery
I really enjoyed Jeff's post on Spartan Programming . I agree that code like

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.