⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lib0118.html

📁 j2ee架构师手册
💻 HTML
字号:
<html>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<head>
<title>Testing Assumptions</title>
<link rel="STYLESHEET" type="text/css" href="images/xpolecat.css">
<link rel="STYLESHEET" type="text/css" href="images/ie.content.css">
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td><div STYLE="MARGIN-LEFT: 0.15in;"><a href="toc.html"><img src="images/teamlib.gif" width="62" height="15" border="0" align="absmiddle"  alt="Team LiB"></a></div></td>
<td align="right"><div STYLE="MARGIN-LEFT: 0.15in;">
<a href="LiB0117.html"><img src="images/previous.gif" width="62" height="15" border="0" align="absmiddle" alt="Previous Section"></a>
<a href="LiB0119.html"><img src="images/next.gif" width="41" height="15" border="0" align="absmiddle" alt="Next Section"></a>
</div></td></tr></table>
<br>
<div class="chapter">
<a name="ch18"></a>
<div class="section">
<h2 class="first-section-title"><a name="583"></a><a name="ch18lev1sec1"></a>Testing Assumptions</h2><p class="first-para">I subscribe to two beliefs about functional testing:</p>
<ul class="itemizedlist">
<li class="first-listitem">
<p class="first-para">Automated testing is better than manual testing.</p>
</li>
<li class="listitem">
<p class="first-para">Finding bugs sooner lowers costs and improves quality.</p>
</li>
</ul>
<p class="para">
<b class="bold">Automated testing is better because it's consistent and easier to run.</b> It doesn't slack off at the end of a hard day, and it's easily repeatable. As a result, automated regression testing for even small changes in the application is more cost-effective. I've seen projects that go so far as to incorporate the test suite in the build script. If one of the regression tests fails, the build fails and the developers are forced to fix the bug.</p>
<p class="para">
<b class="bold">Automated testing is as complete as you want it to be.</b> If you subscribe to the view that test cases should be created as the application is developed, then you also feel that developers should initially create test cases. But these test cases are usually not complete. If you adopt the recommendation that the first step in fixing a bug is writing a test case that reproduces it, your regression test is enhanced as you find more bugs. Over time, you get a robust set of regression tests that increases the probability of finding bugs before deployment.</p>
<p class="para">
<b class="bold">Automated testing isn't free.</b> Creating and maintaining tests consumes manpower, so it's important to use the 80/20 rule. Initially code test cases for the 80 percent of the application that is most complex and most prone to error. You can fill out the remaining 20 percent over time. If you stop to create automated tests that are 100 percent comprehensive, you'll end up adding many hours to the timeline to the extent that the costs will outweigh the benefits.</p>
<p class="para">
<b class="bold">The sooner you find a bug, the less damage it will cause.</b> Damage from bugs occurs in many forms. A bug discovered late in the testing process can impact a project timeline. A bug discovered after deployment can damage users' faith in the system and the development team. And fixing bugs late in the process involves more manpower. At that point, the fix can involve not <a name="584"></a><a name="IDX-245"></a>only the developer but an entire testing team (if your project has them, and many do).</p>
<p class="para">By contrast, news of a bug caught early in the project passes no further than the development team. The testing team and end users won't be directly involved in verifying a fix to a bug they never experienced.</p>
<p class="last-para">As applications mature and gain complexity, automated testing becomes preventative medicine. With complex code comes the likelihood that a developer will fix one problem and inadvertently cause another. Some would say that this is a red flag indicating a need for code refactoring, as discussed in <a href="LiB0126.html#629" target="_parent" class="chapterjump">chapter 20</a>. Automated testing decreases the possibility that a fix to one problem causes another and then goes unnoticed until after production.</p>
</div>
</div><br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td><div STYLE="MARGIN-LEFT: 0.15in;"><a href="toc.html"><img src="images/teamlib.gif" width="62" height="15" border="0" align="absmiddle"  alt="Team LiB"></a></div></td>
<td align="right"><div STYLE="MARGIN-LEFT: 0.15in;">
<a href="LiB0117.html"><img src="images/previous.gif" width="62" height="15" border="0" align="absmiddle" alt="Previous Section"></a>
<a href="LiB0119.html"><img src="images/next.gif" width="41" height="15" border="0" align="absmiddle" alt="Next Section"></a>
</div></td></tr></table>
</body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -