<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Courier New";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size:11.0pt;font-family:"Courier New"">My guess is that it is simply more complex to use a real DB. You need to initialize the database with values that suit your test. Depending on the
 various dependencies, foreign keys and such, you might need to populate a large number of tables.<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size:11.0pt;font-family:"Courier New""><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size:11.0pt;font-family:"Courier New"">However, I fully agree that the resulting tests would be more thorough. In the Django world, we automatically use full databases for tests (typically
 sqlite DBs that are created just for the purpose of the test) and you just write your unit tests so that the necessary tables will be initialized for the needs of your test.<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size:11.0pt;font-family:"Courier New""><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size:11.0pt;font-family:"Courier New"">I think it would be great to have some tests that use a real database, no stubbing. Maybe it could be just one or two to start with, we don’t have
 to throw away all the tests that rely on stubbing.<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size:11.0pt;font-family:"Courier New""><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size:11.0pt;font-family:"Courier New"">Juergen<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size:11.0pt;font-family:"Courier New""><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size:11.0pt;font-family:"Courier New""><o:p> </o:p></span></font></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><font size="2" face="Tahoma"><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";font-weight:bold">From:</span></font></b><font size="2" face="Tahoma"><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Matthew
 Sherborne [mailto:msherborne@gmail.com] <br>
<b><span style="font-weight:bold">Sent:</span></b> Monday, December 10, 2012 1:00 PM<br>
<b><span style="font-weight:bold">To:</span></b> openstack-dev@lists.openstack.org<br>
<b><span style="font-weight:bold">Subject:</span></b> [openstack-dev] Why no test DB ?<o:p></o:p></span></font></p>
</div>
</div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">Why don't we create and destroy a test sqlite in memory database for the tests instead of stubbing out the DB calls ?<o:p></o:p></span></font></p>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"><o:p> </o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><b><font size="3" face="Times New Roman"><span style="font-size:12.0pt;font-weight:bold">Pros:</span></font></b><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">More thorough testing<o:p></o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">More straight forward testing (create records instead of whole mock structures)<o:p></o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">Easier to create new tests, no need to stub everything out again, just use the base test DB<o:p></o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"><o:p> </o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><b><font size="3" face="Times New Roman"><span style="font-size:12.0pt;font-weight:bold">Cons:</span></font></b><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">Probably slower tests<o:p></o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"><o:p> </o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">Has anyone looked at this in the past ?<o:p></o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"><o:p> </o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">All comments appreciated.<o:p></o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"><o:p> </o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">Kind Regards,<o:p></o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">Matthew Sherborne<o:p></o:p></span></font></p>
</div>
</div>
</div>
</body>
</html>