📄 intro.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title> DbUnit - Database Testing </title> <style type="text/css"> @import url("./style/tigris.css"); @import url("./style/maven.css"); </style> <link rel="stylesheet" href="./style/print.css" type="text/css" media="print"></link> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"></meta> </head> <body class="composite"> <div id="banner"> <table border="0" width="100%" cellpadding="8" cellspacing="0"> <tr> <td> <a href="http://www.sourceforge.net/projects/dbunit"> <img border="0" alt="DbUnit.org" src="http://sourceforge.net/sflogo.php?group_id=47439&type=5" align="left"></img> </a> </td> <td> <div id="login" align="right"> <a href="http://www.dbunit.org"> <img border="0" alt="DbUnit" src="./images/dbunit-logo.jpg" align="right"></img> </a> </div> </td> </tr> </table> </div> <div id="breadcrumbs"> <table border="0" width="100%" cellpadding="4" cellspacing="0"> <tr> <td>Last published: 31 May 2004 | Doc for 2.1 </td> <td> <div align="right"> <a href="http://www.dbunit.org/wiki/"><img class="handle" src="./images/none.png" alt=""></img>Wiki</a> | <a href="http://www.sf.net/projects/dbunit"><img class="handle" src="./images/none.png" alt=""></img>SF.net Project Page</a> | <a href="http://maven-plugins.sourceforge.net/maven-dbunit-plugin/index.html"><img class="handle" src="./images/none.png" alt=""></img>Maven Plugin</a> </div> </td> </tr> </table> </div> <table border="0" width="100%" cellpadding="8" cellspacing="0"> <tr valign="top"> <td width="20%" id="leftcol"> <div id="navcolumn"> <div> <strong>Quick Links</strong> <div> <small> <a href="http://sourceforge.net/project/showfiles.php?group_id=47439&release_id=211888"><img class="handle" src="./images/none.png" alt=""></img>Download</a> </small> </div> <div> <small> <a href="changes-report.html"><img class="handle" src="./images/none.png" alt=""></img>Changes</a> </small> </div> <div> <small> <a href="faq.html"><img class="handle" src="./images/none.png" alt=""></img>FAQ</a> </small> </div> <div> <small> <a href="https://sourceforge.net/support/getsupport.php?group_id=47439"><img class="handle" src="./images/none.png" alt=""></img>Get Support</a> </small> </div> <div> <small> <a href="http://www.dbunit.org/wiki/"><img class="handle" src="./images/none.png" alt=""></img>Wiki</a> </small> </div> <div> <small> <a href="cvs-usage.html"><img class="handle" src="./images/none.png" alt=""></img>Source</a> </small> </div> <div> <small> <a href="apidocs/index.html"><img class="handle" src="./images/none.png" alt=""></img>JavaDocs</a> </small> </div> </div> <div> <strong>Overview</strong> <div> <small> <a href="index.html"><img class="handle" src="./images/none.png" alt=""></img>About DbUnit</a> </small> </div> <div> <small> <b><a href="intro.html"><img class="handle" src="./images/none.png" alt=""></img>Database Testing</a></b> </small> </div> <div> <small> <a href="howto.html"><img class="handle" src="./images/none.png" alt=""></img>Getting Started</a> </small> </div> <div> <small> <a href="bestpractices.html"><img class="handle" src="./images/none.png" alt=""></img>Best Practices</a> </small> </div> <div> <small> <a href="components.html"><img class="handle" src="./images/none.png" alt=""></img>Core Components</a> </small> </div> <div> <small> <a href="properties.html"><img class="handle" src="./images/none.png" alt=""></img>Properties</a> </small> </div> <div> <small> <a href="anttask.html"><img class="handle" src="./images/none.png" alt=""></img>Ant Task</a> </small> </div> <div> <small> <a href="resources.html"><img class="handle" src="./images/none.png" alt=""></img>Resources</a> </small> </div> </div> <div> <strong>Project Documentation</strong> <div> <small> <a href="index.html"><img class="handle" src="./images/none.png" alt=""></img>About DbUnit</a> </small> </div> <div> <small> <a href="project-info.html"><img class="handle" src="./images/collapsed.png" alt=""></img>Project Info</a> </small> </div> <div> <small> <a href="maven-reports.html"><img class="handle" src="./images/collapsed.png" alt=""></img>Project Reports</a> </small> </div> <div> <small> <a href="http://maven.apache.org/development-process.html"><img class="handle" src="./images/none.png" alt=""></img>Development Process</a> </small> </div> </div> <div style="margin-top: 20px; width: 100%; text-align: center;"> <a href="http://maven.apache.org/" title="Powered by Maven"><img style="border: 1px solid black" alt="Powered by Maven" src="./images/logos/maven-propaganda.png"></img></a> </div> </div> </td> <td rowspan="2"> <div id="bodycol"> <div class="app"> <div class="h3"> <h3> Database Testing </h3> <p> Richard Dallaway notes about database unit testing inspired me the realization of the DbUnit framework. I think this is a very good text about this subject. Hopefully he gave me the permission to present excerpts from his notes here. </p> <p> The original text is much longer and I strongly suggest you to read it as well. See <a href="resources.html#RichardDallaway"> resources </a> for reference to it. - Manuel Laflamme </p> <p> </p> <h3> Unit testing database </h3> <p> These are my notes on how I've gone about unit testing database functionality. </p> <p> [... ] </p> <p> The problem is this: you have a SQL database, some stored procedures, and a layer of code sitting between your application and the database. How can you put tests in place to make sure your code really is reading and writing the right data from the database? </p> <h4> Why bother? </h4> <p> I'm guessing some, if not a lot, of database development goes like this: set up database, write code to access database, run code, do a SELECT to see if the records showed up in the database. They did? Good, then we're done. </p> <p> The problem with <strong> visual inspection </strong> is this: you don't do it often, and you don't check everything every time. It's possible that when you make changes to a system, maybe months later, you break something and some data will go missing. As a coder you may not spend much time checking the data itself, so it may take a while for this mistake to surface. I've worked on a web project where a mandatory field on a registration form was not being inserted into a database for the best part of a year. Although marketing had protested that they needed this infor mation, the problem wasn't spotted because the data was never ever looked at it (but don't get me started on that). </p> <p> Automated tests
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -