Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<blockquote> <p>Code coverage will ensure I'm <em>hitting</em> every functional piece of code</p> </blockquote> <h3>"Hit" <em>does not</em> mean "Testing"</h3> <p>The problem with only doing web-testing is that it only ensures that you <em>hit</em> the code, and that it <em>appears</em> to be correct at a high-level.</p> <p>Just because you loaded the page, and it didn't crash, doesn't mean that it actually works correctly. Here are some things I've encountered where 'web tests' covered 100% of the code, yet completely missed some very serious bugs which unit testing would not have.</p> <ol> <li>The page loaded correctly from a cache, but the actual database was broken</li> <li>The page loaded every item from the database, but only displayed the first one - it appeared to be fine even though it failed completely in production because it took too long</li> <li>The page displayed a valid-looking number, which was actually wrong, but it wasn't picked up because 1000000 is easy to mistake for 100000</li> <li>The page displayed a valid number by coincidence - 10x50 is the same as 25x20, but one is WRONG</li> <li>The page was supposed to add a log entry to the database, but that's not visible to the user so it wasn't seen.</li> <li>Authentication was bypassed to make the web-tests actually work, so we missed a glaring bug in the authentication code.</li> </ol> <p>It is easy to come up with hundreds more examples of things like this.</p> <p>You need both unit tests to make sure that your code actually does what it is supposed to do at a low level, and then functional/integration (which you're calling web) tests on top of those, to prove that it actually works when all those small unit-tested-pieces are chained together.</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