Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I agree with Mitch. I would add that you should <em>decide</em> whether you want to do an integration test or a unit test (or both, but not in the same test). If, in fact, you do want to do a unit test, realize: </p> <ol> <li>Your code has a "dependency" on an external database.</li> <li>When unit testing you'll have to find a way to "fake" the database. You want to test a "unit" which means a single thing, not two or more things (i.e. your CRUD code AND your connection to a database AND the database itself).</li> <li>Typically you'll need to refactor your code using something like dependency injection so that when unit testing you can fake things that your code depends on.</li> </ol> <p>Unit testing isn't just testing your code. That's actually the easy part. The harder part is <em>making your code testable</em>.</p> <p>I recommend going to <a href="http://artofunittesting.com/" rel="nofollow">http://artofunittesting.com/</a> and watching the free videos on the right side under the heading "Unit Testing Videos". Forget the fact that he's working in .NET as it's the principles that are important.</p> <p>Then watch the GoogleTechTalks by Misko Hevery where he explains why you want to do dependency injection.</p> <p><a href="http://www.youtube.com/watch?v=acjvKJiOvXw" rel="nofollow">Design Tech Talk Series Presents: OO Design for Testability</a></p> <p><a href="http://www.youtube.com/watch?v=wEhu57pih5w" rel="nofollow">The Clean Code Talks -- Unit Testing</a></p> <p>(He has more too. There is a <a href="http://www.youtube.com/playlist?list=PLD0011D00849E1B79" rel="nofollow">series of six GoogleTechTalks</a>.)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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