Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>There are two sides of database testing. </p> <ul> <li><p><strong>One</strong> is oriented to testing database from the <strong>business logic</strong> point of view and should not concern persisted data. At that level there is a well-known technique - <strong>ORM</strong>. Algorithm in this case is simple: <em>describe a model</em> and create a set of <em>unique cases</em> or <em>criterias</em> to test if all cascades actions perform as they should (<em>I mean, if we create <code>Product</code> and link it to <code>Category</code>, than after saving a session we get all entities written in DB with all required relations between</em>). More to say: some ORMs already provide a unit testing module (for example, <em><strong>NHibernate</strong></em>) and some of them even more cool tool: the easiest and the fastest way to create database schemes, models, test cases: for example, <em><strong>Fluent NHibernate</strong></em>. </p></li> <li><p><strong>Second</strong> is oriented to testing <strong>database schema</strong> itself. For that purpose you can look at a good library <a href="http://dbunit.sourceforge.net/" rel="nofollow">DbUnit</a>. Quote from official site:</p></li> </ul> <blockquote> <p>DbUnit is a JUnit extension (also usable with Ant) targeted at database-driven projects that, among other things, puts your database into a <strong>known state between test runs</strong>. DbUnit has the ability to export and import your database data to and from XML datasets. Since version 2.0, DbUnit can also work with very large datasets when used in streaming mode. DbUnit can also help you to verify that your database data <strong>match an expected set of values</strong>. </p> </blockquote> <p>At finally, I highly recommend you to read the article "<a href="http://www.martinfowler.com/articles/evodb.html#ADatabaseConsistsOfSchemaAndTestData" rel="nofollow">Evolutionary Database Design</a>" from <a href="http://www.martinfowler.com" rel="nofollow">Martin Fowler's site</a>. It's a bit outdated (2003), but still worth to read indeed.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload