Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>What do you mean by saying "You're protected from regressing it, because that test will suddenly fail."?</p> </blockquote> <p>The point of "unit tests" is that they will be run automatically as part of the compile/check cycle: you'll run the tests after compiling and before checking code in. If a unit test fails, then you know that some code that <strong>you just wrote</strong> will recreate the old bug. </p> <p>edit: </p> <blockquote> <p>How can you be so sure that just because your unit tests passed all your bugs have been fixed.</p> </blockquote> <p>Generally, if you can reproduce a bug, you can make a test to duplicate it in code. The most important part is once you've written a test to check for the existance of a bug, then if you run the tests, and the test fails, then you reintroduced the bug. One great book on the subject is <a href="http://rads.stackoverflow.com/amzn/click/0131177052" rel="nofollow noreferrer" title="Working Effectively with Legacy Code">"Working Effectively with Legacy Code"</a></p> <blockquote> <p>Is it not possible for a single bug to span multiple unit tests.</p> </blockquote> <p>Of course it can span multiple tests.</p> <p>Let's presume the bug is "can't save files." </p> <p>And let's presume that there are several different scenarios that can cause this: </p> <ul> <li><p>out of disk space,</p></li> <li><p>the file you're writing on top of is opened and locked by another process,</p></li> <li><p>there are permissions problems (like you can't access the directory, or don't have write permissions),</p></li> <li><p>or there is a network error while you're saving the file.</p></li> </ul> <p>Ideally, your test harness (a collection of tests) would have a separate test for each one. For some of the tests, you may need to use stuff that are called "mock objects" (they can also be used when you haven't written the code for the component yet).</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. 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.
 

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