<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Test Driven Developer - TDD</title>
    <link>http://testdrivendeveloper.com/</link>
    <description>You got a TEST for that?</description>
    <language>en-us</language>
    <copyright>John E. Boal</copyright>
    <lastBuildDate>Mon, 28 Jun 2010 05:26:54 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.1.8102.813</generator>
    <managingEditor>web_master1@TestDrivenDeveloper.com</managingEditor>
    <webMaster>web_master1@TestDrivenDeveloper.com</webMaster>
    <item>
      <trackback:ping>http://testdrivendeveloper.com/Trackback.aspx?guid=34c7edfd-ba67-4eaa-9557-b58acb44dc5f</trackback:ping>
      <pingback:server>http://testdrivendeveloper.com/pingback.aspx</pingback:server>
      <pingback:target>http://testdrivendeveloper.com/PermaLink,guid,34c7edfd-ba67-4eaa-9557-b58acb44dc5f.aspx</pingback:target>
      <dc:creator>John E. Boal</dc:creator>
      <wfw:comment>http://testdrivendeveloper.com/CommentView,guid,34c7edfd-ba67-4eaa-9557-b58acb44dc5f.aspx</wfw:comment>
      <wfw:commentRss>http://testdrivendeveloper.com/SyndicationService.asmx/GetEntryCommentsRss?guid=34c7edfd-ba67-4eaa-9557-b58acb44dc5f</wfw:commentRss>
      <title>Balance Between Test-Driven Design and Test Maintenance Overhead</title>
      <guid isPermaLink="false">http://testdrivendeveloper.com/PermaLink,guid,34c7edfd-ba67-4eaa-9557-b58acb44dc5f.aspx</guid>
      <link>http://TestDrivenDeveloper.com/2010/06/28/BalanceBetweenTestDrivenDesignAndTestMaintenanceOverhead.aspx</link>
      <pubDate>Mon, 28 Jun 2010 05:26:54 GMT</pubDate>
      <description>&lt;div&gt;&lt;p&gt;Test-driven Development/Design when practiced properly, yields organic design growth as tests cause feature code to be written in response to failing tests. In *proper* practice, the entire code base is refactored as needed to ensure that all code and design smells are eliminated (while keeping tests passing). This essentially causes the design at any given time to integrate all the features written up to that point. Once this process is completed, the feature code should be relatively complete, if the tests were written well to dictate the behavior required by the customer. If Acceptance-Test Driven Development is used, the Acceptance Tests for the feature passing will indicate that it’s ready to ship. At any given point, the code base that is checked in should withstand the scrutiny of an outside code reviewer, and should embody all the best design principles. If it doesn’t, the “refactor” stage has not yet been completed.&lt;/p&gt;  &lt;h4&gt;Refactoring to Remove Code and Design Smells&lt;/h4&gt;  &lt;p&gt;I find many teams that either poorly implement or flat-out skip the step of refactoring the code base and overall code design as part of this cycle. This kind of organic development - sticking a new feature on a code base without integrating it into the design and making changes as required is like sticking a wad of gum on a bowling ball. It tends to be the entire code base lumpy, obtuse, and generally not pretty to look at. Teams can get away with this kind of development for a while more or less successfully (unfortunately). However this behavior causes LARGE problems for the team or those inheriting maintenance and new feature work on this code base. Often the team will have to stop to rewrite the whole code base at some point, because it’s too problematic to maintain the bowling ball and gum code. In practical business situations, it’s far far easier to maintain the overall design and integrate features into the design, course-correcting the design as needed to absorb all of the features into a coherent architecture.&lt;/p&gt;  &lt;p&gt;This concept of going through the code base and refactoring all of it to embody all the features in it, and removing design and code smells does imply that if the design changes, so must the tests that correspond to the design. If the tests are tightly coupled to the code base, some design changes can be painful in terms of test maintenance overhead. There are methodologies that assist in decoupling the test from the code, and have the test just confirm the behavior without much knowledge of how the implementation is done. The use of polymorphism, mock objects to decouple behaviors from implementation, and the principle of dependency injection in general can assist with decoupling, and make test maintenance less painful (although perhaps somewhat tougher to write at the outset). There is overhead still however with design changes, and that should be expected, embraced, and *estimated* in planning…&lt;/p&gt;  &lt;h4&gt;Plan for Change&lt;/h4&gt;  &lt;p&gt;In iteration planning, changes to the design and implementation, along with test maintenance should be factored in to the estimates for work being done. When breaking out tasks for a story, I like to at least mention if not record a specific task for the design refactoring, and another for the test maintenance for design changes. I personally think these should be more or less estimable by most teams with at least rudimentary skills. If the team is new, add a task with a ballpark guess for the time, but be sure to add the tasks so they have visibility… Scoping the effort for the design changes and test maintenance will be easier and easier going forward as the team gains understanding of what impact new features have. And it is likely that for a team with a good solid design, these changes will be minimal if they are done incrementally.&lt;/p&gt;  &lt;p&gt;Some teams prefer to finish the tasks for the features and their tests, and then have a single story for the design and test maintenance per iteration, and keep copying it from one iteration to the next. This works too, however I have seen issues where the iteration tasks don’t get completed, and the maintenance story gets bumped off or not completed in the sprint. This engineering debt is carried forward, and the code that is checked in for “completed” features for the sprint now carries debt with it as well.&lt;/p&gt;  &lt;p&gt;In my experience, I have seen more success with making the elimination of design and code smells part of the “Done” criteria for each story, and in fact pre-check-in criteria. This way we can’t call a story “Done” [meaning completed, and shippable] until it *really* is. Design and test maintenance changes on a per-story level should be small, and usually bite-size enough for a team to be able to handle operating this way even in a short iteration period.&lt;/p&gt;  &lt;p&gt;Don’t omit the design and test maintenance, plan for it specifically each iteration. This practice will help keep engineering debt from accruing from iteration to iteration. It is a key practice that will help keep a team, a project, and a code base (and a business) all on a successful course for the short, and the longer term.&lt;/p&gt;&lt;img width="0" height="0" src="http://testdrivendeveloper.com/aggbug.ashx?id=34c7edfd-ba67-4eaa-9557-b58acb44dc5f"/&gt;&lt;/div&gt;</description>
      <comments>http://testdrivendeveloper.com/CommentView,guid,34c7edfd-ba67-4eaa-9557-b58acb44dc5f.aspx</comments>
      <category>Mocks</category>
      <category>Refactoring</category>
      <category>TDD</category>
      <category>Unit Tests</category>
    </item>
    <item>
      <trackback:ping>http://testdrivendeveloper.com/Trackback.aspx?guid=1415a1f9-6814-466d-bfcd-5e8b654ea70c</trackback:ping>
      <pingback:server>http://testdrivendeveloper.com/pingback.aspx</pingback:server>
      <pingback:target>http://testdrivendeveloper.com/PermaLink,guid,1415a1f9-6814-466d-bfcd-5e8b654ea70c.aspx</pingback:target>
      <dc:creator>John E. Boal</dc:creator>
      <wfw:comment>http://testdrivendeveloper.com/CommentView,guid,1415a1f9-6814-466d-bfcd-5e8b654ea70c.aspx</wfw:comment>
      <wfw:commentRss>http://testdrivendeveloper.com/SyndicationService.asmx/GetEntryCommentsRss?guid=1415a1f9-6814-466d-bfcd-5e8b654ea70c</wfw:commentRss>
      <title>Find a BUG, Write A TEST</title>
      <guid isPermaLink="false">http://testdrivendeveloper.com/PermaLink,guid,1415a1f9-6814-466d-bfcd-5e8b654ea70c.aspx</guid>
      <link>http://TestDrivenDeveloper.com/2009/09/23/FindABUGWriteATEST.aspx</link>
      <pubDate>Wed, 23 Sep 2009 03:24:00 GMT</pubDate>
      <description>&lt;div&gt;There are many different kinds of bugs that we encounter in software development:&lt;br&gt;&lt;ul&gt;&lt;li&gt;missing functionality (doesn't do what's required)&lt;/li&gt;&lt;li&gt;unanticipated/undesired behavior (it did what??)&lt;br&gt;&lt;/li&gt;&lt;li&gt;failure to check boundaries (or boundary conditions [e.g null])&lt;/li&gt;&lt;li&gt;user-interface issues (usability)&lt;/li&gt;&lt;li&gt;miscalculations (and logic errors)&lt;/li&gt;&lt;li&gt;control flow errors (failing to break out of a loop, etc.)&lt;br&gt;&lt;/li&gt;&lt;li&gt;failure to handle errors (unhandled exceptions)&lt;br&gt;&lt;/li&gt;&lt;li&gt;security issues (Spoofing, Tampering, Repudiation, Information Disclosure, Denial of Service, Elevation of privilege)&lt;br&gt;&lt;/li&gt;&lt;li&gt;data interpretation errors (what date is 11/12/13 anyway?)&lt;br&gt;&lt;/li&gt;&lt;li&gt;interoperability errors (sending/receiving incorrect messages or data)&lt;br&gt;&lt;/li&gt;&lt;/ul&gt;and most likely lots of others. Each of these areas has bugs that are all examples of opportunities to write a test that were missed along the development path.&lt;br&gt;&lt;br&gt;Here is a simple real-world example. Today my Log file writing routine threw an unhandled exception when the file it was trying to write to was in use by another application (this is failure to handle errors, above). This caused the app to crash with an unhandled exception. In truth, I had written the code TDD, so it had tests, but none of them held the file open while it attempted to log data.&lt;br&gt;&lt;br&gt;This was an unanticipated condition, but probably one that should have been pretty obvious too. However, I was trying to keep the code as simple as possible, and it's not a multi-threaded app, so there wouldn't have been *internal* collisions anyway. Regardless, the app crashing because its log file is being edited is probably not the desired behavior. So (being the test driven developer) I wrote this test first, to illustrate the bug:&lt;br&gt;&lt;br&gt;&lt;font face="Courier New"&gt;[&lt;/font&gt;&lt;font color="#7fffd4" face="Courier New"&gt;Test&lt;/font&gt;&lt;font face="Courier New"&gt;]&lt;br&gt;&lt;font color="#0000ff"&gt;public void&lt;/font&gt; TestLogFileInUse()&lt;br&gt;{&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; using (&lt;/font&gt;&lt;font color="#7fffd4" face="Courier New"&gt;FileStream &lt;/font&gt;&lt;font face="Courier New"&gt;stream = &lt;/font&gt;&lt;font color="#7fffd4" face="Courier New"&gt;File&lt;/font&gt;&lt;font face="Courier New"&gt;.OpenWrite(&lt;/font&gt;&lt;font color="#7fffd4" face="Courier New"&gt;Utilities&lt;/font&gt;&lt;font face="Courier New"&gt;.LogFileName))&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="#7fffd4" face="Courier New"&gt;Utilities&lt;/font&gt;&lt;font face="Courier New"&gt;.Log(&lt;font color="#a52a2a"&gt;"test"&lt;/font&gt;);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;}&lt;br&gt;&lt;/font&gt;&lt;br&gt;it's really simple, but it definitely did fail when the Log() method threw an exception because his file was being held open by the test. Only after I had a failing test, did I then modify the code to catch the IOException and handle it without crashing the application. I could also check for an event log entry if the file write fails, if that was the desired behavior.&lt;br&gt;&lt;br&gt;The test is fast and simple, and it now guarantees not only that I fixed the bug by making the test pass [not crashing, the only requirement here] but also that the issue will never come back again.&lt;br&gt;&lt;br&gt;This may be an almost trivial case, but it does illustrate how to use TDD when fixing bugs. I shouldn't really ever be adding new functionality to the mainline code without a failing test of some kind. Refactoring doesn't count, because we only refactor when all the tests are passing. Refactoring doesn't add any new functionality, it is just reorganizing the existing code to make it better.&lt;br&gt;&lt;br&gt;The worst thing about fixing bugs is when they pop back up later... We hate regressions, because then we have to re-do re-done work YET AGAIN... Lean says that defects are waste, and if they come back after being fixed, then that makes the time spent on fixing them the second time even more wasteful.&lt;br&gt;&lt;br&gt;This method of "find a bug &amp;gt;&amp;gt; write a test" is a Test-Driven approach to solving issues and making sure they never come back. Let's make regressions an artifact of history, and never fix a bug without having a failing test first!&lt;br&gt;&lt;p&gt;&lt;/p&gt;&lt;img width="0" height="0" src="http://testdrivendeveloper.com/aggbug.ashx?id=1415a1f9-6814-466d-bfcd-5e8b654ea70c"/&gt;&lt;/div&gt;</description>
      <comments>http://testdrivendeveloper.com/CommentView,guid,1415a1f9-6814-466d-bfcd-5e8b654ea70c.aspx</comments>
      <category>TDD</category>
      <category>Bugs</category>
    </item>
    <item>
      <trackback:ping>http://testdrivendeveloper.com/Trackback.aspx?guid=27d85768-3c56-481c-9205-bdc2565a2259</trackback:ping>
      <pingback:server>http://testdrivendeveloper.com/pingback.aspx</pingback:server>
      <pingback:target>http://testdrivendeveloper.com/PermaLink,guid,27d85768-3c56-481c-9205-bdc2565a2259.aspx</pingback:target>
      <dc:creator>John E. Boal</dc:creator>
      <wfw:comment>http://testdrivendeveloper.com/CommentView,guid,27d85768-3c56-481c-9205-bdc2565a2259.aspx</wfw:comment>
      <wfw:commentRss>http://testdrivendeveloper.com/SyndicationService.asmx/GetEntryCommentsRss?guid=27d85768-3c56-481c-9205-bdc2565a2259</wfw:commentRss>
      <title>Red, Green, Done.</title>
      <guid isPermaLink="false">http://testdrivendeveloper.com/PermaLink,guid,27d85768-3c56-481c-9205-bdc2565a2259.aspx</guid>
      <link>http://TestDrivenDeveloper.com/2009/06/04/RedGreenDone.aspx</link>
      <pubDate>Thu, 04 Jun 2009 20:17:50 GMT</pubDate>
      <description>&lt;div&gt;TDD is a great practice to use for code success, as long as the *entire* process is followed...&lt;br&gt;&lt;br&gt;write tests&lt;br&gt;write code&lt;br&gt;refactor&lt;br&gt;all tests green&lt;br&gt;we're done right?&lt;br&gt;&lt;br&gt;Refactoring is the Key to Successful TDD.&lt;br&gt;We need to look at the changes we made as part of the whole, NOT just in the small. We may have just added a method to a class that makes the class now responsible for more than just the one thing it was before... That's now a code smell (or design smell). When we've refactored the code to make it testable, we're not really done...&lt;br&gt;&lt;br&gt;We now need to take a step back, and look at the overall design, the archtecture, and how our implementation is satisfying the problems we are solving. We should make sure at this point in time that we can say everything is "well-designed" and "well-implemented."&lt;br&gt;&lt;br&gt;So many teams that are new to TDD, or that just practice test-first development, tend to forget this CRUCIALLY IMPORTANT step... It's not done, it's not estimated, and often the consequences are simply ignored until it gets to the point that the entire code base is impossible to maintain. This Technical Debt or Engineering Debt goes unaccounted in so many cases. Sometimes, this result ends up being one of the factors that teams use to stop using TDD. When compared to traditional waterfall design models, the output of teams that omit this critical step does not nearly measure up to the designs of waterfall methodology.&lt;br&gt;&lt;br&gt;There's no free lunch... We still need to have time in our plan for DESIGN. In waterfall, it's all up-front. With TDD and refactoring, we need to do it after we have written the code. We can't just "omit it" - otherwise we're not really "done."&lt;br&gt;&lt;br&gt;Each time I complete a story, part of my done criteria is to hold up the entire system to a bright light, and look through it for code and design smells. If there are any, it really isn't Done Done Done. I may check in the working code, but I don't close the story as complete until this task is finished.&lt;br&gt;&lt;br&gt;I estimate in a guess at least for time for sniffing out code and design smells on each story. My guideline for this is at least 10% of the time the rest of the tasks on the story take. Sometimes this clearly isn't enough, as when a story or feature causes significant re-design, or the adaption of an existing design to a new strategy. Use judgement on the estimate, but *AT LEAST* include the task for each story, even if it doesn't get estimated. This method will keep the issue out in the open and remind everyone that it still needs to be done.&lt;br&gt;&lt;br&gt;If your product owner balks at this additional time (and they most always do) remind them that its a little penalty now, or a HUGE one later. Unless it's a very short-term project on a temporary system, this is almost always a required task, so that maintenance and upkeep - even in the next sprint - aren't blown out of proportion.&lt;br&gt;&lt;br&gt;At the end of the day, the TEAM is responsible for deciding the best course of action to satifsy the the stakeholders, and even if the PO resists, the development management chain is *still* a stakeholder... As professional developers we really should have the ability to push back on a resistant PO with good quality engineering standards.&lt;br&gt;&lt;br&gt;Educate your PO's. Make sure people understand how important this critical step is in the story. Place a task on each story for design refactoring. And, last but not least, you can always place a large poster of a nose with a red line through it in the team space and caption it *No Code Smells*" ...&lt;br&gt;&lt;p&gt;&lt;/p&gt;&lt;img width="0" height="0" src="http://testdrivendeveloper.com/aggbug.ashx?id=27d85768-3c56-481c-9205-bdc2565a2259"/&gt;&lt;/div&gt;</description>
      <comments>http://testdrivendeveloper.com/CommentView,guid,27d85768-3c56-481c-9205-bdc2565a2259.aspx</comments>
      <category>Refactoring</category>
      <category>TDD</category>
    </item>
    <item>
      <trackback:ping>http://testdrivendeveloper.com/Trackback.aspx?guid=3672cae1-a523-409d-a5a3-0e032b6f8ebb</trackback:ping>
      <pingback:server>http://testdrivendeveloper.com/pingback.aspx</pingback:server>
      <pingback:target>http://testdrivendeveloper.com/PermaLink,guid,3672cae1-a523-409d-a5a3-0e032b6f8ebb.aspx</pingback:target>
      <dc:creator>John E. Boal</dc:creator>
      <wfw:comment>http://testdrivendeveloper.com/CommentView,guid,3672cae1-a523-409d-a5a3-0e032b6f8ebb.aspx</wfw:comment>
      <wfw:commentRss>http://testdrivendeveloper.com/SyndicationService.asmx/GetEntryCommentsRss?guid=3672cae1-a523-409d-a5a3-0e032b6f8ebb</wfw:commentRss>
      <title>&lt; Rant &gt;</title>
      <guid isPermaLink="false">http://testdrivendeveloper.com/PermaLink,guid,3672cae1-a523-409d-a5a3-0e032b6f8ebb.aspx</guid>
      <link>http://TestDrivenDeveloper.com/2009/04/08/.aspx</link>
      <pubDate>Wed, 08 Apr 2009 19:05:23 GMT</pubDate>
      <description>&lt;div&gt;OK people. STOP putting cowboy code on my desk. Seriously. TEST your software. REALLY. Please STOP writing BRAND NEW LEGACY code.&lt;br&gt;&amp;lt; /Rant &amp;gt;&lt;br&gt;&lt;br&gt;OK I feel better. But not really. Just because a system is not considered to be a "production release" (meaning that people outside the particular organization or business won't have access to it) it DOES NOT mean that we can cowboy it up and plop a steaming pile of untested code out there for our colleagues or coworkers to consume.&lt;br&gt;&lt;br&gt;ALL CODE NEEDS TESTS. Period.&lt;br&gt;&lt;br&gt;Untested code is NOT finished. Please don't just assume that if the code "works" that it's ready to inflict on other people (or even yourself). Self-inflicted legacy code casualties are the second highest cause of career paralysis, according to 4 out of 5 dentists. By definition, code is "legacy" if it doesn't have tests.&lt;br&gt;&lt;br&gt;Here's a plan to get your tests caught up.&lt;br&gt;&lt;br&gt;Start Small&lt;br&gt;At least we need a set of "sanity" checks... if nothing else. Create a "test suite." Use xUnit or the like, keep it simple. Start with the checks for the obvious output... if that doesn't show up, then something is clearly broken.&lt;br&gt;&lt;br&gt;Add Some More&lt;br&gt;One at a time if you have to, add another test for something. Any kind of test will do... unit, functional, acceptance... I recommend starting with acceptance and working backward. We already blew the op to be able to do TDD and get unit testing done, so now let's just make sure the surface behavior is adequate. Definitely do go in deeper if time permits.&lt;br&gt;&lt;br&gt;New Feature&lt;br&gt;Each time a new feature is added, update the test suite to make sure everything is happy with changes that ripple out from the effect of the feature. Again - at least make sure that the obvious functionality is tested on the new code. Don't slack on it, keep at least the new code from being legacy.&lt;br&gt;&lt;br&gt;Lather, Rinse, Repeat&lt;br&gt;Pick a time each week (say 4:30PM on Wednesdays) to put in a half-hour on writing one new test. Schedule it. Block the time out on your calendar so someone can't schedule a meeting... And hide if you have to - to avoid distractions.&lt;br&gt;&lt;br&gt;What to Write&lt;br&gt;Focus on happy-path code tests only if there are none for that feature. Otherwise, do alternate and failure path tests, so that the behavior of the system is understood in circumstances other than the best-case. 90% of bugs occur in the not-happy path.&lt;br&gt;&lt;br&gt;Using this strategy will get testing started, and contribute to a more robust and reliable product, no matter what it is. Remember that most "side projects" or "utilities" that are developed in-house will be used by your own people. We want them to have the best.&lt;br&gt;&lt;br&gt;"But it's just a spreadsheet." OK, yes it is. I say we need to make sure
to test even the lowly spreadsheet. Because, next week someone in
Finance is going to discover it and begin to use it for their payroll
planning... if there is a critical flaw in it, it might be YOUR
paycheck that gets eliminated!&lt;br&gt;
&lt;br&gt;We should realize that even internal tools and web sites are usually used to make business decisions of some kind. We want to make sure that they are made using reliable tools, to the extent possible. Business relies on its data, now more than ever. Competition is fierce in a down economy - even small mistakes can be a big problem.&lt;br&gt;&lt;br&gt;"Bread's not done until it's baked" - and neither is code! SO PLEASE: Test it. Bake it. Slice it... and don't get burned!&lt;br&gt;&lt;br&gt;&lt;p&gt;&lt;/p&gt;&lt;img width="0" height="0" src="http://testdrivendeveloper.com/aggbug.ashx?id=3672cae1-a523-409d-a5a3-0e032b6f8ebb"/&gt;&lt;/div&gt;</description>
      <comments>http://testdrivendeveloper.com/CommentView,guid,3672cae1-a523-409d-a5a3-0e032b6f8ebb.aspx</comments>
      <category>TDD</category>
      <category>Testing</category>
      <category>Unit Tests</category>
    </item>
    <item>
      <trackback:ping>http://testdrivendeveloper.com/Trackback.aspx?guid=e4a0b4b3-fe4c-4089-ba7a-ad605a61b53a</trackback:ping>
      <pingback:server>http://testdrivendeveloper.com/pingback.aspx</pingback:server>
      <pingback:target>http://testdrivendeveloper.com/PermaLink,guid,e4a0b4b3-fe4c-4089-ba7a-ad605a61b53a.aspx</pingback:target>
      <dc:creator>John E. Boal</dc:creator>
      <wfw:comment>http://testdrivendeveloper.com/CommentView,guid,e4a0b4b3-fe4c-4089-ba7a-ad605a61b53a.aspx</wfw:comment>
      <wfw:commentRss>http://testdrivendeveloper.com/SyndicationService.asmx/GetEntryCommentsRss?guid=e4a0b4b3-fe4c-4089-ba7a-ad605a61b53a</wfw:commentRss>
      <title>Writing Unit Tests With Test Driven Development</title>
      <guid isPermaLink="false">http://testdrivendeveloper.com/PermaLink,guid,e4a0b4b3-fe4c-4089-ba7a-ad605a61b53a.aspx</guid>
      <link>http://TestDrivenDeveloper.com/2009/01/20/WritingUnitTestsWithTestDrivenDevelopment.aspx</link>
      <pubDate>Tue, 20 Jan 2009 01:11:28 GMT</pubDate>
      <description>&lt;div&gt;I recently recorded a tutorial video of a presentation I am working on. The video is intended to be an introduction to TDD, and how actually to go about writing tests and code using TDD. I hear a lot of people using the term "TDD" without really understanding it. They typically are referring to "unit testing" or sometimes even test-first development, neither of which are really TDD. So my thought was to show it actually being done.&lt;br&gt;&lt;br&gt;It is my first attempt ever to record a video presentation, and there is some kind of hum on the audio I couldn't get rid of - sorry. I was able to convert it to a down-res format (quick-time), using the HandBrake converter tool. Hopefully it's still readable. This is unscripted and off-the-cuff, so I am sure there's lots of room for improvement. If you have suggestions, please feel free to post a comment below. Otherwise, enjoy!&lt;br&gt;&lt;br&gt;&lt;a href="http://TestDrivenDeveloper.com/WritingUnitTestsUsingTestDrivenDevelopment.m4v" target="_tddvid"&gt;&lt;b&gt;Writing Unit Tests Using Test-Driven Development&lt;/b&gt;&lt;/a&gt; Apple QuickTime format, 65MB, 28 min.&lt;br&gt;&lt;p&gt;&lt;/p&gt;&lt;img width="0" height="0" src="http://testdrivendeveloper.com/aggbug.ashx?id=e4a0b4b3-fe4c-4089-ba7a-ad605a61b53a"/&gt;&lt;/div&gt;</description>
      <comments>http://testdrivendeveloper.com/CommentView,guid,e4a0b4b3-fe4c-4089-ba7a-ad605a61b53a.aspx</comments>
      <category>TDD</category>
      <category>Video</category>
    </item>
    <item>
      <trackback:ping>http://testdrivendeveloper.com/Trackback.aspx?guid=1e3c09f4-3d6b-42de-8f65-1ab51807452b</trackback:ping>
      <pingback:server>http://testdrivendeveloper.com/pingback.aspx</pingback:server>
      <pingback:target>http://testdrivendeveloper.com/PermaLink,guid,1e3c09f4-3d6b-42de-8f65-1ab51807452b.aspx</pingback:target>
      <dc:creator>John E. Boal</dc:creator>
      <wfw:comment>http://testdrivendeveloper.com/CommentView,guid,1e3c09f4-3d6b-42de-8f65-1ab51807452b.aspx</wfw:comment>
      <wfw:commentRss>http://testdrivendeveloper.com/SyndicationService.asmx/GetEntryCommentsRss?guid=1e3c09f4-3d6b-42de-8f65-1ab51807452b</wfw:commentRss>
      <title>Scrum, TDD and Seven Other Buzzwords</title>
      <guid isPermaLink="false">http://testdrivendeveloper.com/PermaLink,guid,1e3c09f4-3d6b-42de-8f65-1ab51807452b.aspx</guid>
      <link>http://TestDrivenDeveloper.com/2008/12/17/ScrumTDDAndSevenOtherBuzzwords.aspx</link>
      <pubDate>Wed, 17 Dec 2008 02:33:12 GMT</pubDate>
      <description>&lt;div&gt;"We need to do TDD" said the client.&lt;br&gt;"Our team is not producing quality code, and aren't performing up to our expectations."&lt;br&gt;"So, we need to introduce TDD to make sure we get what we need."&lt;br&gt;&lt;br&gt;Uh-huh I thought. Thinking to myself... so, why aren't your developers producing quality code? What are they doing instead? Are they even unit testing at all now? Do they know how to test or are unit tests just an afterthought? oh yeah, and are there any other methodologies you need to add for your team to be buzzword-compliant!?&lt;br&gt;&lt;br&gt;TDD is not just a buzzword. TDD is not just a methodology a team can adopt if they are in trouble. Not hardly. TDD is the top of the pyramid. It requires a mind-shift that is not tremendously difficult, but at the same time is very difficult to accomplish without discipline. Not every team is ready for this step. I would hope to have a cohesive, collaborative, and performant team, teach them how to write good tests (first or last), show them how acceptance criteria can be automated into tests that guide the team toward completion. After going through all of these pieces, I would then introduce TDD as a small thing, and the discipline required would probably already be there at that point.&lt;br&gt;&lt;br&gt;While it may be in vogue to say a team is "agile" and uses "tdd" (note: here in lower case) it's much more important that a team is producing quality software - buzzwords or not. I am not exactly advocating non-tdd practices, but on the other hand we need to be practical about delivery also. If a team can truly do test-driven development, then congratulations I say, they are well positioned to be at the top of the heap. If not, I would try to lead the team in the direction to be ready for TDD, whether or not it gets used. Strong unit testing along with other kinds of testing will deliver the quality that customers need. So, evolve. Learn, Test well. And, if you can, use TDD.. it's great!&lt;br&gt;&lt;p&gt;&lt;/p&gt;&lt;img width="0" height="0" src="http://testdrivendeveloper.com/aggbug.ashx?id=1e3c09f4-3d6b-42de-8f65-1ab51807452b"/&gt;&lt;/div&gt;</description>
      <comments>http://testdrivendeveloper.com/CommentView,guid,1e3c09f4-3d6b-42de-8f65-1ab51807452b.aspx</comments>
      <category>TDD</category>
    </item>
    <item>
      <trackback:ping>http://testdrivendeveloper.com/Trackback.aspx?guid=0410f15c-efe2-4de5-8886-d6dec7a8b696</trackback:ping>
      <pingback:server>http://testdrivendeveloper.com/pingback.aspx</pingback:server>
      <pingback:target>http://testdrivendeveloper.com/PermaLink,guid,0410f15c-efe2-4de5-8886-d6dec7a8b696.aspx</pingback:target>
      <dc:creator>John E. Boal</dc:creator>
      <wfw:comment>http://testdrivendeveloper.com/CommentView,guid,0410f15c-efe2-4de5-8886-d6dec7a8b696.aspx</wfw:comment>
      <wfw:commentRss>http://testdrivendeveloper.com/SyndicationService.asmx/GetEntryCommentsRss?guid=0410f15c-efe2-4de5-8886-d6dec7a8b696</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <title>TDD or not TDD? That isn't the question.</title>
      <guid isPermaLink="false">http://testdrivendeveloper.com/PermaLink,guid,0410f15c-efe2-4de5-8886-d6dec7a8b696.aspx</guid>
      <link>http://TestDrivenDeveloper.com/2008/12/09/TDDOrNotTDDThatIsntTheQuestion.aspx</link>
      <pubDate>Tue, 09 Dec 2008 20:17:56 GMT</pubDate>
      <description>&lt;div&gt;"TDD makes code development take longer."&lt;br&gt;Yes, it does. 15-30% longer.&lt;br&gt;&lt;br&gt;"TDD *may* reduce bug counts..."&lt;br&gt;Real TDD WILL reduce bug counts. Expect about an order of magnitude. 60-90% comparably.&lt;br&gt;&lt;br&gt;"I don't want to pay up front for testing or make the code take longer to be feature complete."&lt;br&gt;That is one choice - but it will be a costly one... Defects will not only be more frequent, but they will probably take longer to fix and be more complex as well.&lt;br&gt;&lt;br&gt;From a financial perspective, (aside from the customer satisfaction) TDD just makes fiscal sense. I think we would need a compelling reason to give management and shareholders why we are NOT using it.&lt;br&gt;&lt;br&gt;There is a &lt;a href="http://channel9.msdn.com/posts/Peli/Experimental-study-about-Test-Driven-Development/"&gt;new video posted on Channel 9&lt;/a&gt; of an interview of one of the Microsoft researchers who contributed to a set of &lt;a href="http://www.springerlink.com/content/q91566748q234325/fulltext.pdf"&gt;case studies&lt;/a&gt; published earlier this year. The case studies were done on 4 teams (3 Microsoft and 1 IBM), and they seem to agree with the statistics and team performance numbers I have been citing for years.&lt;br&gt;&lt;br&gt;These numbers are motivators for me, and some of the primary reasons I practice TDD, support it, and try to spread the word.&lt;br&gt;&lt;br&gt;Please take a look at the &lt;a href="http://www.springerlink.com/content/q91566748q234325/fulltext.pdf"&gt;report&lt;/a&gt; and see for yourself if you agree...&lt;br&gt;&lt;br&gt;&lt;p&gt;&lt;/p&gt;&lt;img width="0" height="0" src="http://testdrivendeveloper.com/aggbug.ashx?id=0410f15c-efe2-4de5-8886-d6dec7a8b696"/&gt;&lt;/div&gt;</description>
      <comments>http://testdrivendeveloper.com/CommentView,guid,0410f15c-efe2-4de5-8886-d6dec7a8b696.aspx</comments>
      <category>TDD</category>
    </item>
    <item>
      <trackback:ping>http://testdrivendeveloper.com/Trackback.aspx?guid=e36a37f3-53c9-460d-8042-ee50090f0ad0</trackback:ping>
      <pingback:server>http://testdrivendeveloper.com/pingback.aspx</pingback:server>
      <pingback:target>http://testdrivendeveloper.com/PermaLink,guid,e36a37f3-53c9-460d-8042-ee50090f0ad0.aspx</pingback:target>
      <dc:creator>John E. Boal</dc:creator>
      <wfw:comment>http://testdrivendeveloper.com/CommentView,guid,e36a37f3-53c9-460d-8042-ee50090f0ad0.aspx</wfw:comment>
      <wfw:commentRss>http://testdrivendeveloper.com/SyndicationService.asmx/GetEntryCommentsRss?guid=e36a37f3-53c9-460d-8042-ee50090f0ad0</wfw:commentRss>
      <title>Unit Testing and Test Driven Development - a Practical Guide</title>
      <guid isPermaLink="false">http://testdrivendeveloper.com/PermaLink,guid,e36a37f3-53c9-460d-8042-ee50090f0ad0.aspx</guid>
      <link>http://TestDrivenDeveloper.com/2008/11/15/UnitTestingAndTestDrivenDevelopmentAPracticalGuide.aspx</link>
      <pubDate>Sat, 15 Nov 2008 21:08:59 GMT</pubDate>
      <description>&lt;div&gt;Here is a presentation I wrote on what Unit Testing is all about, and how TDD fits into the ATDD cycle.&lt;br&gt;&lt;br&gt;There are specific things here on testing the UI code with Selenium and JSUnit, and recommendations on how to do unit testing on your database code.&lt;br&gt;&lt;br&gt;This presentation is in PDF format, but I can post the PPTX format also if needed.&lt;br&gt;&lt;p&gt;&lt;/p&gt;&lt;a href="http://testdrivendeveloper.com/content/binary/A%20Practical%20Guide%20to%20Unit%20Testing1.pdf"&gt;A Practical Guide to Unit Testing1.pdf (503.29 KB)&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;img width="0" height="0" src="http://testdrivendeveloper.com/aggbug.ashx?id=e36a37f3-53c9-460d-8042-ee50090f0ad0"/&gt;&lt;/div&gt;</description>
      <comments>http://testdrivendeveloper.com/CommentView,guid,e36a37f3-53c9-460d-8042-ee50090f0ad0.aspx</comments>
      <category>ATDD</category>
      <category>Mocks</category>
      <category>Refactoring</category>
      <category>Selenium</category>
      <category>TDD</category>
      <category>Testing</category>
      <category>Unit Tests</category>
      <category>SQL</category>
    </item>
    <item>
      <trackback:ping>http://testdrivendeveloper.com/Trackback.aspx?guid=729dde91-6a43-4e82-88ec-356af2667b62</trackback:ping>
      <pingback:server>http://testdrivendeveloper.com/pingback.aspx</pingback:server>
      <pingback:target>http://testdrivendeveloper.com/PermaLink,guid,729dde91-6a43-4e82-88ec-356af2667b62.aspx</pingback:target>
      <dc:creator>John E. Boal</dc:creator>
      <wfw:comment>http://testdrivendeveloper.com/CommentView,guid,729dde91-6a43-4e82-88ec-356af2667b62.aspx</wfw:comment>
      <wfw:commentRss>http://testdrivendeveloper.com/SyndicationService.asmx/GetEntryCommentsRss?guid=729dde91-6a43-4e82-88ec-356af2667b62</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <title>Test-Driven Process Improvement with Refactoring, Value Stream Mapping, and Windows Workflow</title>
      <guid isPermaLink="false">http://testdrivendeveloper.com/PermaLink,guid,729dde91-6a43-4e82-88ec-356af2667b62.aspx</guid>
      <link>http://TestDrivenDeveloper.com/2008/10/30/TestDrivenProcessImprovementWithRefactoringValueStreamMappingAndWindowsWorkflow.aspx</link>
      <pubDate>Thu, 30 Oct 2008 20:47:03 GMT</pubDate>
      <description>&lt;div&gt;Value Stream Mapping [VSM] is a lean concept that helps us improve our processes by focusing on the whole process and making stepwise refinements on smaller parts of the process, to gain improvement for the whole. It is in a sense, "Refactoring" a process.&lt;br&gt;&lt;br&gt;In an ideal case, a process can be thought of as a workflow, and perhaps we might be able to represent it using the WF Windows Workflow Foundation code delivered in .NET 3.5. It would be nice to show a code example here of how we can represent a process with workflow steps, but I didn't have time to write up an example as of yet.&lt;br&gt;&lt;br&gt;With VSM, we are trying to improve a process by mapping it into parts, each of which we can study. We can gather metrics on each of the process steps, and metrics on how long things wait between steps. The waiting between steps is usually far more significant time-wise than any of the steps themselves. WF can be instrumental in providing an automated framework for collecting and reporting these metrics.&lt;br&gt;&lt;br&gt;Indeed there are also other workflow alternatives of course. BizTalk Server 2006 R2 is a fine candidate for workflow representation as well, when adapters are available for systems that interoperate. I have a specific Microsoft focus in my career, but I have used CapeClear as a Java-based workflow system, and there are others in the ESB space which have features that would allow us to collect metrics on an automated representation of our processes.&lt;br&gt;&lt;br&gt;Automation is key to refactoring, as in any development mechanism. We can't fix what we don't know is broken. With VSM, we focus on the entire process as a whole, so we need to collect measurements on where it is today, and then we can see total improvement on the whole as we make small changes (refactoring the process).&lt;br&gt;&lt;br&gt;Many enterprises today use Service-Oriented Architecture [SOA] as a design pattern for the construction of enterprise systems. This architecture lends itself well to the use of WF or BizTalk (substiitute your favorite flavor here) workflow components. SOA helps us to map the entire process to blocks of functionality that we can measure and monitor easily, contributing to our VSM overall picture.&lt;br&gt;&lt;br&gt;My theory is that like with software development, process improvement can also have a test-driven, scientific approach. VSM is a tool that helps us change the right things to improve our overall process, but it typically has measurements in large units - days, even weeks. With the right automation framework contributing to very rapid feedback with the metrics collected on processes, we can write tests that indicate Red or Green for not only each component being analyzed, but for the entire process as well.&lt;br&gt;&lt;br&gt;Tests don't have to be in the form of an NUnit DLL or test fixture. We can use simple reports actually to give us the feedback we need to make decisions on how we refactor. Think of it as moving test-driven concepts a couple elevations higher in the plan view. From the 500 foot view to the 5000 foot view if you will. It's the exact same concept, just applied at a somewhat higher level of abstraction.&lt;br&gt;&lt;br&gt;For each of our services we monitor the time taken in the process and the time between processes, and compare them to our initial baseline. We might even be able to get real-time data on a visible dashboard in the best of cirumstances. When we are better than our initial baseline, we are Green, if not, then we're Red. There is no yellow - same result means we haven't improved so it's still red. This concept is brutally simple, but it can be very effective, especially if the Red/Green report is made visible on a web-based report.&lt;br&gt;&lt;br&gt;Mapping the workflow using WF, BizTalk, or other tools gives us a way to take automated measurements and compare them to our baseline to render a decision on whether our process has improved or not, and whether we are reaching our overall goal of total improvement. Individual portions of the whole can still be red as long as we achieve green for the overall process.&lt;br&gt;&lt;br&gt;A business process really is a workflow, we just need to map it as such using software and automation. In this way we can apply the fine concepts of test-driven and refactoring to process improvement, once again using automation and measurement as our top key tools for leveraging our own technologies to help us improve them.&lt;br&gt;&lt;br&gt;Code examples here would be good of course... Stay tuned for future posts with WF code examples of a process flow that has metrics and baseline comparisons for Red/Green.&lt;br&gt;&lt;p&gt;&lt;/p&gt;&lt;img width="0" height="0" src="http://testdrivendeveloper.com/aggbug.ashx?id=729dde91-6a43-4e82-88ec-356af2667b62"/&gt;&lt;/div&gt;</description>
      <comments>http://testdrivendeveloper.com/CommentView,guid,729dde91-6a43-4e82-88ec-356af2667b62.aspx</comments>
      <category>Automation</category>
      <category>Refactoring</category>
      <category>TDD</category>
      <category>Tools</category>
    </item>
    <item>
      <trackback:ping>http://testdrivendeveloper.com/Trackback.aspx?guid=9c73a72b-9654-4976-83b5-e3f9b6b67e3f</trackback:ping>
      <pingback:server>http://testdrivendeveloper.com/pingback.aspx</pingback:server>
      <pingback:target>http://testdrivendeveloper.com/PermaLink,guid,9c73a72b-9654-4976-83b5-e3f9b6b67e3f.aspx</pingback:target>
      <dc:creator>John E. Boal</dc:creator>
      <wfw:comment>http://testdrivendeveloper.com/CommentView,guid,9c73a72b-9654-4976-83b5-e3f9b6b67e3f.aspx</wfw:comment>
      <wfw:commentRss>http://testdrivendeveloper.com/SyndicationService.asmx/GetEntryCommentsRss?guid=9c73a72b-9654-4976-83b5-e3f9b6b67e3f</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <title>Unit Testing in Python</title>
      <guid isPermaLink="false">http://testdrivendeveloper.com/PermaLink,guid,9c73a72b-9654-4976-83b5-e3f9b6b67e3f.aspx</guid>
      <link>http://TestDrivenDeveloper.com/2008/09/30/UnitTestingInPython.aspx</link>
      <pubDate>Tue, 30 Sep 2008 13:26:26 GMT</pubDate>
      <description>&lt;div&gt;&lt;P&gt;I have been using IronPython lately, and am having a good time testing code with its built-in unit test framework. Here is a brief example of how to write some unit tests for &lt;a target=_ipy href="http://www.codeplex.com/IronPython"&gt;IronPython&lt;/a&gt; (or CPython if that's your flavor). These unit tests&amp;nbsp;leverage the "unittest" module available in Python 2.2 and above.&lt;/P&gt;
&lt;P&gt;Here is a short test class:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff&gt;class&lt;/FONT&gt; TestCode:&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; localInt = &lt;FONT color=#ff0000&gt;1&lt;/FONT&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; @classmethod&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;FONT color=#0000ff&gt;def&lt;/FONT&gt; &lt;FONT color=#ff1493&gt;Method1&lt;/FONT&gt;(self):&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; &lt;FONT color=#ff0000&gt;100&lt;/FONT&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;FONT color=#0000ff&gt;def&lt;/FONT&gt; &lt;FONT color=#ff1493&gt;Method2&lt;/FONT&gt;(self, a, b):&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.localInt = a * b&lt;BR&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Here are&amp;nbsp;some sample&amp;nbsp;unit tests for it, using the unittest framework:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff&gt;import&lt;/FONT&gt; unittest&lt;BR&gt;&lt;FONT color=#0000ff&gt;class&lt;/FONT&gt; UnitTests(unittest.TestCase):&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;FONT color=#0000ff&gt;def&lt;/FONT&gt; &lt;FONT color=#ff1493&gt;testMethod1&lt;/FONT&gt;(self):&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cut = TestCode()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; actual = cut.Method1()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.assertEqual(&lt;FONT color=#ff0000&gt;100&lt;/FONT&gt;, actual)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;FONT color=#0000ff&gt;def&lt;/FONT&gt; &lt;FONT color=#ff1493&gt;teststaticInt&lt;/FONT&gt;(self):&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.assertEqual(&lt;FONT color=#ff0000&gt;1&lt;/FONT&gt;, TestCode.localInt)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;FONT color=#0000ff&gt;def&lt;/FONT&gt; &lt;FONT color=#ff1493&gt;testMethod2&lt;/FONT&gt;(self):&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cut = TestCode()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cut.Method2(&lt;FONT color=#ff0000&gt;7&lt;/FONT&gt;, &lt;FONT color=#ff0000&gt;4&lt;/FONT&gt;)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.assertEqual(&lt;FONT color=#ff0000&gt;28&lt;/FONT&gt;, cut.localInt)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff&gt;if&lt;/FONT&gt; __name__ == '&lt;FONT color=#808080&gt;__main__&lt;/FONT&gt;':&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; unittest.main()&lt;BR&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;This example should illustrate that we can write some unit tests for our Python code fairly easily and quickly. It's nice to have a built-in framework for unit testing. There is also a "doctest" module available for doing more like system testing. I am pretty new to Python, so I haven't got examples of this as yet.&lt;/P&gt;
&lt;P&gt;If anyone has any suggestions on tools&amp;nbsp;or experience with &lt;A href="http://blogs.msdn.com/aaronmar/archive/2006/02/16/533273.aspx"&gt;integration with Visual Studio&lt;/A&gt;&amp;nbsp;those comments would be appreciated.&lt;/P&gt;&lt;img width="0" height="0" src="http://testdrivendeveloper.com/aggbug.ashx?id=9c73a72b-9654-4976-83b5-e3f9b6b67e3f"/&gt;&lt;/div&gt;</description>
      <comments>http://testdrivendeveloper.com/CommentView,guid,9c73a72b-9654-4976-83b5-e3f9b6b67e3f.aspx</comments>
      <category>TDD</category>
      <category>Testing</category>
      <category>Tools</category>
      <category>Python</category>
    </item>
    <item>
      <trackback:ping>http://testdrivendeveloper.com/Trackback.aspx?guid=5872ed9c-4504-4cef-909d-4e2efe0d7269</trackback:ping>
      <pingback:server>http://testdrivendeveloper.com/pingback.aspx</pingback:server>
      <pingback:target>http://testdrivendeveloper.com/PermaLink,guid,5872ed9c-4504-4cef-909d-4e2efe0d7269.aspx</pingback:target>
      <dc:creator>John E. Boal</dc:creator>
      <wfw:comment>http://testdrivendeveloper.com/CommentView,guid,5872ed9c-4504-4cef-909d-4e2efe0d7269.aspx</wfw:comment>
      <wfw:commentRss>http://testdrivendeveloper.com/SyndicationService.asmx/GetEntryCommentsRss?guid=5872ed9c-4504-4cef-909d-4e2efe0d7269</wfw:commentRss>
      <title>Sample Code for Selenium and WatiN tests</title>
      <guid isPermaLink="false">http://testdrivendeveloper.com/PermaLink,guid,5872ed9c-4504-4cef-909d-4e2efe0d7269.aspx</guid>
      <link>http://TestDrivenDeveloper.com/2008/08/26/SampleCodeForSeleniumAndWatiNTests.aspx</link>
      <pubDate>Tue, 26 Aug 2008 15:03:11 GMT</pubDate>
      <description>&lt;div&gt;I posted a simple sample of accepance test code in Selenium and WatiN along with a sample web site to test. You can download the zip file &lt;a href="http://agilebug.com/ct.ashx?id=f4b673d3-cdfe-4a3d-b740-907c1b2cb362&amp;amp;url=http%3a%2f%2fagilebug.com%2fcontent%2fbinary%2fATDDdemo.zip"&gt;here&lt;/a&gt;.&lt;br&gt;&lt;br&gt;I also have posted a Fitnesse fixture in that zip file that illustrates how we can create a simple test fixture for Fitnesse acceptance testing. The Fitnesse tests aren't in the set, but here is the page wiki code that makes use of the fixture:&lt;br&gt;&lt;br&gt;&lt;font face="Courier New" size="2"&gt;!define COMMAND_PATTERN {%m %p}&lt;br&gt;!define TEST_RUNNER {dotnet\FitServer.exe}&lt;br&gt;!define PATH_SEPARATOR {;}&lt;br&gt;!path dotnet\*.dll&lt;br&gt;&lt;br&gt;Here is an acceptance test using our BusinessObjectTestFixture test class:&lt;br&gt;&lt;br&gt;!|FitnesseFixture.BusinessObjectTestFixture|&lt;br&gt;|UserId|Password|Authenticate()|&lt;br&gt;|administrator|secret0|ADMIN|&lt;br&gt;|admin|secret0|NONE|&lt;br&gt;|administrator|secret|NONE|&lt;br&gt;|user11|secret11|USER|&lt;br&gt;|user11|secret0|NONE|&lt;br&gt;|user|secret|NONE|&lt;br&gt;&lt;/font&gt;&lt;br&gt;&lt;br&gt;I also created some STIQ tests, here is the code for the tests and components. Extract this zip file under repository\ProjectRoot folder and it should be able to test the sample site also.&lt;br&gt;&lt;br&gt;&lt;a href="http://testdrivendeveloper.com/content/binary/ATDDSTIQ.zip"&gt;ATDDSTIQ.zip (3.57 KB)&lt;/a&gt;&lt;img width="0" height="0" src="http://testdrivendeveloper.com/aggbug.ashx?id=5872ed9c-4504-4cef-909d-4e2efe0d7269"/&gt;&lt;/div&gt;</description>
      <comments>http://testdrivendeveloper.com/CommentView,guid,5872ed9c-4504-4cef-909d-4e2efe0d7269.aspx</comments>
      <category>ATDD</category>
      <category>Automation</category>
      <category>Selenium</category>
      <category>TDD</category>
      <category>Testing</category>
      <category>Tools</category>
      <category>WatiN</category>
    </item>
    <item>
      <trackback:ping>http://testdrivendeveloper.com/Trackback.aspx?guid=f5421cea-42ee-4c60-8339-385ff172a931</trackback:ping>
      <pingback:server>http://testdrivendeveloper.com/pingback.aspx</pingback:server>
      <pingback:target>http://testdrivendeveloper.com/PermaLink,guid,f5421cea-42ee-4c60-8339-385ff172a931.aspx</pingback:target>
      <dc:creator>John E. Boal</dc:creator>
      <wfw:comment>http://testdrivendeveloper.com/CommentView,guid,f5421cea-42ee-4c60-8339-385ff172a931.aspx</wfw:comment>
      <wfw:commentRss>http://testdrivendeveloper.com/SyndicationService.asmx/GetEntryCommentsRss?guid=f5421cea-42ee-4c60-8339-385ff172a931</wfw:commentRss>
      <title>Do you test your installer?</title>
      <guid isPermaLink="false">http://testdrivendeveloper.com/PermaLink,guid,f5421cea-42ee-4c60-8339-385ff172a931.aspx</guid>
      <link>http://TestDrivenDeveloper.com/2008/07/01/DoYouTestYourInstaller.aspx</link>
      <pubDate>Tue, 01 Jul 2008 04:41:41 GMT</pubDate>
      <description>&lt;div&gt;Do you write installers? A lot of times I hear that all the features or stories are completed, but nobody has given any thought to how actually to ship the software and install it. This is not a trivial story, and usually it is the user's first experience with the software, so if it doesn't go well, your reputation starts out in the hole and that's not easy to overcome. Let's assume that we are more thorough and professional than the average joe, and we create an installer for our application that does three things: Install, Upgrade, and Uninstall.&lt;br&gt;&lt;br&gt;Most of the time I write installers that are MSI or Setup.exe based, since I sort of get those for free with Visual Studio and .NET. If I have a file or dependency, I simply add it to the package and tell it where on the target machine it is supposed to go. It gets compiled and built (only by DEVENV.EXE by the way - MSBUILD doesn't know how to build setup projects...) after the main assemblies.&lt;br&gt;&lt;br&gt;The main assemblies all have unit tests of course that run with the build, so everybody is green before anything gets built to install. Installers can be kind of tricky. Don't be tempted to run it on your native development box. If you haven't got lots of proven experience with them, be sure to run the installer for the first few iterations ONLY on a virtual machine that you can restore to its original image with a couple clicks. Let's just say I have seen some interesting recursive registry damage from an installer...&lt;br&gt;&lt;br&gt;We need tests for the installer, but in this case we are not talking about "unit" tests, but rather functional tests. We need the tests to actually install and uninstall the software.&lt;br&gt;&lt;br&gt;&lt;b&gt;&lt;font size="4"&gt;Testing the Installer Code&lt;br&gt;&lt;/font&gt;&lt;/b&gt;First up - test the UNinstall. From my experience, I have seen this path as the best one to start with. Install it manually only after the failing test has been created (and test it only on the VM). You can use either NUnit or MSTest as the framework to run the installer. HINT: to uninstall the software exec this command line:&lt;br&gt;MSIEXEC /X {guid}&lt;br&gt;where guid is the identifier for your project. This guid can be found in the .VDPROJ file as the key called "ProductCode." Don't change this value ever, or it will disconnect your next install from your current uninstall, and all kinds of weirdness can happen.&lt;br&gt;&lt;br&gt;Assert that the registry keys get removed from CurrentVersion as discussed below, and that any registry entries created by the installer are removed.&lt;br&gt;&lt;br&gt;&lt;b&gt;&lt;font size="4"&gt;Gotcha&lt;/font&gt;&lt;/b&gt;&lt;br&gt;So it didn't work as planned, and there's an error... an Assert fails, which throws an exception, and your tests end and have left the software installed on the system. The next time the install test runs, it won't work because the software will already be installed. So... make sure you have try-catch logic on everything before you assert anything. The finally block should call a function that uninstalls the product. We know that it will work, because we have tests for it...&lt;br&gt;&lt;br&gt;Unlike most unit tests where we want to be able to run tests in any order, and have complete independence, functional tests for an installer are much simpler to write if they can be run in the Install, Upgrade, and Uninstall order. However, we don't write them in this order, we start with the uninstall first, then add tests for install, and finally the upgrade cases.&lt;br&gt;&lt;br&gt;Make sure to catch everything done by the installer in the uninstall test, and do not proceed to write install tests until you are absolutely certain that the uninstall works properly and is adequately tested.&lt;br&gt;&lt;br&gt;When you move on to the install case, it should be a bit easier, as all you need do is reverse the tests in the uninstall. Make sure that you place this test code before the uninstall test code, so that it is now automated.&lt;br&gt;&lt;br&gt;Now, voila - you have automated tests for your install code. Finally, your upgrade test can be written to confirm the behavior if the installer is run on a system where the software is already installed. You may want to just fail the install and tell the user to uninstall the previous version, or you may want to upgrade in place. A true upgrade is far nicer to the user, but it is a lot of complexity some times when data migration, customized configurations, or other scenarios are needed. Make sure that any of this functionality is captured in stories, and documented with thorough testing.&lt;br&gt;&lt;br&gt;&lt;font size="4"&gt;&lt;b&gt;What do I test?&lt;br&gt;&lt;/b&gt;&lt;/font&gt;&lt;ul&gt;&lt;li&gt;Make sure to open the registry after you install your application, and find the key to make sure you can uninstall it later:&lt;/li&gt;&lt;ul&gt;&lt;li&gt;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{guid}&lt;/li&gt;&lt;li&gt;This key's value should have the above mentioned MSIEXEC uninstall statement. Check it with an assert to make sure it's correct.&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;Make sure each of the assemblies and executables are sent to the correct target folder on the target machine.&lt;/li&gt;&lt;li&gt;If you support command line options or fancy things for the installer, make sure to test each and every one.&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Write the tests first of course...&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;Make sure that config files, documentation, and support files (such as XML or other things) are delivered to the correct locations.&lt;/li&gt;&lt;li&gt;If any files are dynamically generated or modified by the installer with custom actions after delivery, make sure that the modifications are correct.&lt;br&gt;&lt;/li&gt;&lt;li&gt;Make sure that directories are created on install&lt;/li&gt;&lt;li&gt;Make sure that the ACL security on the folders and files is correct, if this is something your installer does.&lt;br&gt;&lt;/li&gt;&lt;li&gt;Make sure that directories are deleted on uninstall (except if logs or other artifacts are in them, they won't be deleted)&lt;br&gt;&lt;/li&gt;&lt;li&gt;Make sure these things are written in such a way that they are easy to call from a test, and that they handle errors and take care to leave the system in the same state as before the tests ran (with the software uninstalled).&lt;br&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;&lt;b&gt;&lt;font size="4"&gt;Where do I run the tests?&lt;br&gt;&lt;/font&gt;&lt;/b&gt;
A word of advice: DO NOT RUN THESE TESTS ON THE BUILD SERVER... it is
tempting since they look like "unit" tests, but don't do it. Build
servers are not something we want to be messing with installing and
uninstalling software. Especially software that gets built every few
minutes... The best way to automate the whole process is to have the build server build the app, the installer, and the installer tests and deliver them to an install server, or sandbox server. This can be done through a build step that copies all the executables to a UNC share on the sandbox server after each build. The sandbox server can be set to watch for new files in a folder and automatically begin to run the tests. If you are using CruiseControl.net, this is nicely accomplished by running CC.NET on both the sandbox server and the build server. The build server can "import" the red/green status of the functional tests from the installer to its own dashboard, just as if they were local. It takes a bit of work to get this all figured out, but once it's done it is a nice way to live. I wish I had all my CC.NET code to post, but unfortunately it belongs to someone else and I don't have the rights to post it. If someone has wrapped this concept up in an easier to run turn-key package I would love to hear about it with a comment.&lt;br&gt;
&lt;br&gt;
If there are any questions about this, please feel free to comment below and I will try to reply as soon as I am able.&lt;br&gt;&lt;img width="0" height="0" src="http://testdrivendeveloper.com/aggbug.ashx?id=f5421cea-42ee-4c60-8339-385ff172a931"/&gt;&lt;/div&gt;</description>
      <comments>http://testdrivendeveloper.com/CommentView,guid,f5421cea-42ee-4c60-8339-385ff172a931.aspx</comments>
      <category>TDD</category>
      <category>Testing</category>
    </item>
    <item>
      <trackback:ping>http://testdrivendeveloper.com/Trackback.aspx?guid=2dda944f-e700-47bf-9a85-4e806eae920f</trackback:ping>
      <pingback:server>http://testdrivendeveloper.com/pingback.aspx</pingback:server>
      <pingback:target>http://testdrivendeveloper.com/PermaLink,guid,2dda944f-e700-47bf-9a85-4e806eae920f.aspx</pingback:target>
      <dc:creator>John E. Boal</dc:creator>
      <wfw:comment>http://testdrivendeveloper.com/CommentView,guid,2dda944f-e700-47bf-9a85-4e806eae920f.aspx</wfw:comment>
      <wfw:commentRss>http://testdrivendeveloper.com/SyndicationService.asmx/GetEntryCommentsRss?guid=2dda944f-e700-47bf-9a85-4e806eae920f</wfw:commentRss>
      <title>Multi-threading Unit Tests</title>
      <guid isPermaLink="false">http://testdrivendeveloper.com/PermaLink,guid,2dda944f-e700-47bf-9a85-4e806eae920f.aspx</guid>
      <link>http://TestDrivenDeveloper.com/2008/06/04/MultithreadingUnitTests.aspx</link>
      <pubDate>Wed, 04 Jun 2008 21:20:10 GMT</pubDate>
      <description>&lt;div&gt;&lt;b&gt;&lt;font size="4"&gt;Why to Do It&lt;/font&gt;&lt;/b&gt;&lt;br&gt;When running lots of unit tests, there are distinct advantages in using all of those cores and cpu's that most of our modern computers have. We can parallelize testing so that we gain two distinct advantages. First, the testing will complete much faster. If you have 4 cpu's or 4 cores, we should see at least a halving of test time, if not more. Secondly, we prove our code is able to run in the closer-to-real-world scenario that other things might be going on while our code under test is executing. Plus its just cool to do multi-threading.&lt;br&gt;&lt;br&gt;The by-product or side effect benefit we get also in multi-threading our tests is that we need to put more careful thought into the design and construction of test cases, and by that virtue, our software under test. The ability to multi-thread tests is I think one of the highest bars we have in demonstrating conclusively that our software is robust.&lt;br&gt;&lt;br&gt;&lt;b&gt;&lt;font size="4"&gt;Advice on How to Do It&lt;br&gt;&lt;/font&gt;&lt;/b&gt;Separate tests into separate test assemblies that can be launched by the build server in parallel. There is no real reason to sequence tests, unless they sometimes interfere with each other. If they do interfere with each other, the tests are poorly designed and should be re-written as independent.&lt;br&gt;&lt;br&gt;See the &lt;a href="http://www.amazon.com/Pragmatic-Unit-Testing-NUnit-2nd/dp/0977616673/ref=pd_bbs_sr_1?ie=UTF8&amp;amp;s=books&amp;amp;qid=1212767277&amp;amp;sr=8-1"&gt;Pragmatic Unit Testing book&lt;/a&gt; or see &lt;a href="http://thought-tracker.blogspot.com/2005/11/notes-on-pragmatic-unit-testing.html"&gt;this article&lt;/a&gt; for good advice on how to write good tests that you can parallelize.&lt;br&gt;&lt;br&gt;Tests must be thread-safe. We probably should be able to run the same test at the same time without collisions.&lt;br&gt;Tests must be TRULY independent. This usually means that tests need to generate data that is keyed specific to that test run.&lt;br&gt;Tests must not have side-effects. They must leave the test system in the state they found it.&lt;br&gt;&lt;br&gt;The new version of NUnit (2.5) is rumored to have functionality to be able to run tests in parallel threads. The currently released version has only one thread to run all the tests. In some preliminary research I have done, when manually coding up multiple threads to run each test in parallel from a single "unit test" method, it has some contradictory behavior. NUnit reports that all tests pass, but the GUI bar turns red.&lt;br&gt;&lt;br&gt;More to follow on multi-threading test with MS Test...&lt;br&gt;&lt;p&gt;&lt;/p&gt;&lt;img width="0" height="0" src="http://testdrivendeveloper.com/aggbug.ashx?id=2dda944f-e700-47bf-9a85-4e806eae920f"/&gt;&lt;/div&gt;</description>
      <comments>http://testdrivendeveloper.com/CommentView,guid,2dda944f-e700-47bf-9a85-4e806eae920f.aspx</comments>
      <category>C#</category>
      <category>TDD</category>
      <category>Testing</category>
    </item>
    <item>
      <trackback:ping>http://testdrivendeveloper.com/Trackback.aspx?guid=5b08a3b3-85a8-4c3b-b6d3-76cf1c796f8c</trackback:ping>
      <pingback:server>http://testdrivendeveloper.com/pingback.aspx</pingback:server>
      <pingback:target>http://testdrivendeveloper.com/PermaLink,guid,5b08a3b3-85a8-4c3b-b6d3-76cf1c796f8c.aspx</pingback:target>
      <dc:creator>John E. Boal</dc:creator>
      <wfw:comment>http://testdrivendeveloper.com/CommentView,guid,5b08a3b3-85a8-4c3b-b6d3-76cf1c796f8c.aspx</wfw:comment>
      <wfw:commentRss>http://testdrivendeveloper.com/SyndicationService.asmx/GetEntryCommentsRss?guid=5b08a3b3-85a8-4c3b-b6d3-76cf1c796f8c</wfw:commentRss>
      <title>Testing the Paint Truck</title>
      <guid isPermaLink="false">http://testdrivendeveloper.com/PermaLink,guid,5b08a3b3-85a8-4c3b-b6d3-76cf1c796f8c.aspx</guid>
      <link>http://TestDrivenDeveloper.com/2008/06/03/TestingThePaintTruck.aspx</link>
      <pubDate>Tue, 03 Jun 2008 18:55:32 GMT</pubDate>
      <description>&lt;div&gt;&lt;P&gt;I was explaining to someone about different types of testing I do with my code, and how mock objects can be used in unit tests. I used the example of the paint truck at the airport that spray-paints lines on the tarmac. Its job is to put down wide lines, narrow lines, in yellow, and white, and of a certain length, at specific places on the runways and taxiways. The truck is driven by a person, and the paint spray system is operated by&amp;nbsp;driver. It's not a perfect example, but it may get the point across.&lt;/P&gt;
&lt;P&gt;When we model this with truck software and try to test it,&amp;nbsp;most developers seem to tend to go right for testing the whole solution end to end.&amp;nbsp;That means&amp;nbsp;trying to figure out how to fire up the engine, position the truck at&amp;nbsp;certain coordinates, be at a certain speed, and then test the spray gun and see if it paints the correct stripes. It's a hard problem to solve, to try to set up with all these things&amp;nbsp;and get it just right - just to see if the painter works properly. It can be a daunting task to try to test software this way, yet most developers who do "unit testing" are trying to do just this kind of thing. My take is that this is not really "unit testing" but actually "functional" testing. While it is definitely good to have functional tests, I prefer my development team to focus on more narrow areas such as individual classes. If these are thoughtfully designed and&amp;nbsp;tested individually, they should work well when combined. This is also where integration and scenario testing come in. These types of tests are beyond the scope of unit tests.&lt;/P&gt;
&lt;P&gt;Let me give an example that explains how we might be able to go about testing this a bit more carefully. Let's take the truck as a single "system" and the paint sprayer as a separate "system." These systems are really not very coupled - the sprayer runs on the truck's electric system, but that's about it. It makes sense to decouple them in trying to test them.&lt;/P&gt;
&lt;P&gt;If we separate out the sprayer as a separate system, the only inputs it needs from the truck&amp;nbsp;are the electrical connection and the trigger input. We can "mock" out these connections by supplying a new power source and trigger input connector&amp;nbsp;that has the same "interface" (that is -&amp;nbsp;implements the same interface class in code). Now we can test the system without needing to have the actual truck around. This is the&amp;nbsp;concept of mock objects at its best in unit testing.&lt;/P&gt;
&lt;P&gt;We can separate even the power mock object from the trigger mock object. We can control how these mock objects behave precisely, and keep them in specific states so that the only variables under test are in the sprayer system. We can then test what happens to the sprayer if we make the power go away, what happens if we trigger both paint guns at the same time, and making sure we can turn on and off each gun. These make great unit tests and document how our code is supposed to work. They should run very fast, and not require any diesel fuel...&lt;/P&gt;
&lt;P&gt;All of the ability we have to be able to mock things like this, depends on programming to interfaces, which is a long-time engineering best practice to avoid decoupling. If we design our software to implement interfaces, we can then easily substitute dependency systems at test time with our own controlled version, and focus the testing on a more narrow area, while making the tests run faster at the same time.&lt;/P&gt;&lt;img width="0" height="0" src="http://testdrivendeveloper.com/aggbug.ashx?id=5b08a3b3-85a8-4c3b-b6d3-76cf1c796f8c"/&gt;&lt;/div&gt;</description>
      <comments>http://testdrivendeveloper.com/CommentView,guid,5b08a3b3-85a8-4c3b-b6d3-76cf1c796f8c.aspx</comments>
      <category>TDD</category>
      <category>Testing</category>
      <category>Mocks</category>
    </item>
    <item>
      <trackback:ping>http://testdrivendeveloper.com/Trackback.aspx?guid=479d0bc6-9415-477b-ab7c-1df1e67ea53f</trackback:ping>
      <pingback:server>http://testdrivendeveloper.com/pingback.aspx</pingback:server>
      <pingback:target>http://testdrivendeveloper.com/PermaLink,guid,479d0bc6-9415-477b-ab7c-1df1e67ea53f.aspx</pingback:target>
      <dc:creator>John E. Boal</dc:creator>
      <wfw:comment>http://testdrivendeveloper.com/CommentView,guid,479d0bc6-9415-477b-ab7c-1df1e67ea53f.aspx</wfw:comment>
      <wfw:commentRss>http://testdrivendeveloper.com/SyndicationService.asmx/GetEntryCommentsRss?guid=479d0bc6-9415-477b-ab7c-1df1e67ea53f</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <title>Tools and Tips</title>
      <guid isPermaLink="false">http://testdrivendeveloper.com/PermaLink,guid,479d0bc6-9415-477b-ab7c-1df1e67ea53f.aspx</guid>
      <link>http://TestDrivenDeveloper.com/2008/06/03/ToolsAndTips.aspx</link>
      <pubDate>Tue, 03 Jun 2008 06:31:40 GMT</pubDate>
      <description>&lt;div&gt;I have been using TestDriven.net as a tool now for a few weeks, and I have to say that it is a fine addition to my tools collection. It gives me the flexibility I need to run tests in any manner I choose, simply by right-clicking. It's a Visual Studio add-in for 2005, and 2008, and it works seamlessly with a variety of test frameworks (NUnit, MbUnit, and MSTest being the most notable).&lt;br&gt;&lt;p&gt;&lt;/p&gt;&lt;br&gt;Speaking of NUnit, another excellent tool that I find invaluable to help me test my code. NUnit now has RowTest extensions (like MbUnit) in the production release (2.4.7 and if you aren't using this version, you should upgrade), and &lt;a href="http://blogs.nunit.com/"&gt;Parameterized Tests&lt;/a&gt; coming soon, and they look really cool. I find that I can replace a lot of repetition in my tests with this row based system. It enables me to write more tests faster, and that's always good. I am hoping that the new release goes into production mode very soon.&lt;br&gt;&lt;br&gt;UI testing with Selenium is another favorite topic, I will write up another article later with examples of how to do real automated user interface testing using NUnit and Selenium. However, feel free to start playing with it now... its a great tool also, and plays nicely with the other tools in the toolbox.&lt;br&gt;&lt;br&gt;Use these tools in good health, to help get your code into production as bug-free as possible by testing the heck out of it!&lt;br&gt;&lt;br&gt;P.S.&lt;br&gt;Please make your unit tests into separate assemblies... no one-massive-monolithic-test assemblies please... and the tests should run FAST. If you mock out all the database, network, web service, etc. calls, you should be able to get all of your tests in an assembly run in under 5 seconds. Aim for a target of 100 tests per second, and you will be a much happier camper.&lt;br&gt;&lt;br&gt;If you are a real stickler for this (and I recommend it...) add this code to your test assemblies:&lt;br&gt;&lt;pre&gt;&lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;private&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;static&lt;/span&gt; DateTime assemblyStart;

 [ClassInitialize]
 &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;static&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;void&lt;/span&gt; MyClassInitialize(TestContext testContext)
 {
     assemblyStart &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; DateTime.Now;
 }

 [TestCleanup]
 &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;static&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;void&lt;/span&gt; TestCleanup()
 {
     Assert.IsTrue(
         assemblyStart.AddMilliseconds(5000) &amp;gt; DateTime.Now,
         &lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"Tests took too long to execute."&lt;/span&gt;);
 }
&lt;/span&gt;&lt;/pre&gt;Enjoy!&lt;br&gt;&lt;img width="0" height="0" src="http://testdrivendeveloper.com/aggbug.ashx?id=479d0bc6-9415-477b-ab7c-1df1e67ea53f"/&gt;&lt;/div&gt;</description>
      <comments>http://testdrivendeveloper.com/CommentView,guid,479d0bc6-9415-477b-ab7c-1df1e67ea53f.aspx</comments>
      <category>C#</category>
      <category>TDD</category>
      <category>Testing</category>
    </item>
    <item>
      <trackback:ping>http://testdrivendeveloper.com/Trackback.aspx?guid=c6fb6dfb-8cd1-4fc5-92c7-c8b975959329</trackback:ping>
      <pingback:server>http://testdrivendeveloper.com/pingback.aspx</pingback:server>
      <pingback:target>http://testdrivendeveloper.com/PermaLink,guid,c6fb6dfb-8cd1-4fc5-92c7-c8b975959329.aspx</pingback:target>
      <dc:creator>John E. Boal</dc:creator>
      <wfw:comment>http://testdrivendeveloper.com/CommentView,guid,c6fb6dfb-8cd1-4fc5-92c7-c8b975959329.aspx</wfw:comment>
      <wfw:commentRss>http://testdrivendeveloper.com/SyndicationService.asmx/GetEntryCommentsRss?guid=c6fb6dfb-8cd1-4fc5-92c7-c8b975959329</wfw:commentRss>
      <title>C# String.IsNullOrEmpty Method - Making Sure Our Strings Are Valid</title>
      <guid isPermaLink="false">http://testdrivendeveloper.com/PermaLink,guid,c6fb6dfb-8cd1-4fc5-92c7-c8b975959329.aspx</guid>
      <link>http://TestDrivenDeveloper.com/2008/05/14/CStringIsNullOrEmptyMethodMakingSureOurStringsAreValid.aspx</link>
      <pubDate>Wed, 14 May 2008 15:21:24 GMT</pubDate>
      <description>&lt;div&gt;OK people, for some reason this little gem has been overlooked by an awful lot of developers. Every time I see someone write an if statement that checks to see if a string is null, then if it is empty, I have to cringe. This static method on the String class is a very handy mechanism to do something that is extremely common in code I see.&lt;br&gt;&lt;br&gt;instead of this&lt;br&gt;&lt;br&gt;&lt;font color="#0000ff"&gt;if&lt;/font&gt; (str == &lt;font color="#0000ff"&gt;null &lt;/font&gt;|| str == &lt;font color="#7fffd4"&gt;String&lt;/font&gt;.Empty)&lt;br&gt;{&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; doSomething();&lt;br&gt;}&lt;br&gt;&lt;p&gt;&lt;/p&gt;&lt;br&gt;use this:&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;font color="#0000ff"&gt;if &lt;/font&gt;(&lt;font color="#7fffd4"&gt;String&lt;/font&gt;.IsNullOrEmpty(str))&lt;br&gt;{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; doSomething();&lt;br&gt;
}&lt;br&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;It is so much cleaner, and faster too I think.&lt;/p&gt;&lt;p&gt;Just remember that this should probably be the first thing we write in the main line code after the second unit test is failing, for any method that takes a string parameter... [you know, the test where we send null in as the string parameter... then we have to write the if statement in the main code]. Which then follows closely with the third unit test in which we pass String.Empty as the value. But then again you already knew that. :-)&lt;br&gt;&lt;/p&gt;&lt;img width="0" height="0" src="http://testdrivendeveloper.com/aggbug.ashx?id=c6fb6dfb-8cd1-4fc5-92c7-c8b975959329"/&gt;&lt;/div&gt;</description>
      <comments>http://testdrivendeveloper.com/CommentView,guid,c6fb6dfb-8cd1-4fc5-92c7-c8b975959329.aspx</comments>
      <category>TDD</category>
      <category>C#</category>
    </item>
    <item>
      <trackback:ping>http://testdrivendeveloper.com/Trackback.aspx?guid=9eda991a-3ada-4e70-84d8-1194fa5edda7</trackback:ping>
      <pingback:server>http://testdrivendeveloper.com/pingback.aspx</pingback:server>
      <pingback:target>http://testdrivendeveloper.com/PermaLink,guid,9eda991a-3ada-4e70-84d8-1194fa5edda7.aspx</pingback:target>
      <dc:creator>John E. Boal</dc:creator>
      <wfw:comment>http://testdrivendeveloper.com/CommentView,guid,9eda991a-3ada-4e70-84d8-1194fa5edda7.aspx</wfw:comment>
      <wfw:commentRss>http://testdrivendeveloper.com/SyndicationService.asmx/GetEntryCommentsRss?guid=9eda991a-3ada-4e70-84d8-1194fa5edda7</wfw:commentRss>
      <title>Acceptance Test Driven Development, Explained</title>
      <guid isPermaLink="false">http://testdrivendeveloper.com/PermaLink,guid,9eda991a-3ada-4e70-84d8-1194fa5edda7.aspx</guid>
      <link>http://TestDrivenDeveloper.com/2008/04/02/AcceptanceTestDrivenDevelopmentExplained.aspx</link>
      <pubDate>Wed, 02 Apr 2008 06:10:03 GMT</pubDate>
      <description>&lt;div&gt;&lt;p&gt;
&lt;table border="0" cellpadding="10" cellspacing="0" width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;font color="#052230" face="Arial" size="2"&gt;Acceptance criteria should be our 
measuring stick when we write software. These criteria should give us the 
direction to go in writing features, and ultimately the final answer on whether 
the software is "done" or meets the customer's need. When the customer (or the 
customer representative, product owner, or business analyst) gives us a notion 
of what the software is to do for them, it represents a guideline and a goal for 
our development. 
&lt;/font&gt;&lt;br&gt;&lt;br&gt;&lt;!-- BOF buynow --&gt;&lt;!-- EOF buynow --&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;!-- EOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;&lt;/p&gt;
&lt;p&gt;&lt;!-- BOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;
&lt;table border="0" cellpadding="10" cellspacing="0" width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;font color="#052230" face="Arial" size="2"&gt;This article is a discussion of ATDD 
in an Agile development context with Scrum project management and Extreme 
Programming [XP] development methodology. However it does not apply specifically 
to Agile. These same techniques can be applied with almost any mechanism. 
&lt;/font&gt;&lt;br&gt;&lt;br&gt;&lt;!-- BOF buynow --&gt;&lt;!-- EOF buynow --&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;!-- EOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;&lt;/p&gt;
&lt;p&gt;&lt;!-- BOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;
&lt;table border="0" cellpadding="10" cellspacing="0" width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;font color="#052230" face="Arial" size="2"&gt;Test-Driven Development [TDD] says 
that we should first write a test before we write the code. This forces us to 
understand clearly what the code is to do, because we have to write the test to 
verify it. Writing the test is usually the hard part - the code next is easier. 
This is where the discipline of TDD is most needed. The test itself should be 
failing when executed, since we don't have the code under test [CUT]. This is a 
good sign - we need to actually "test the test." We then write as little CUT 
code as needed, just to make the test pass. Then, we start all over again - 
write a test, some more code, etc. We refactor the CUT as needed, to make it a 
cohesive, maintainable design, while still keeping all the tests passing. In 
this way, we have a complete test framework wrapped around our high-quality 
code, which makes certain that the code always functions the way we intended no 
matter what kinds of changes we make internally to it. &lt;/font&gt;&lt;br&gt;&lt;br&gt;&lt;!-- BOF buynow --&gt;&lt;!-- EOF buynow --&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;!-- EOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;&lt;/p&gt;
&lt;p&gt;&lt;!-- BOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;
&lt;table border="0" cellpadding="10" cellspacing="0" width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;font color="#052230" face="Arial" size="2"&gt;This process of TDD as described, is 
the traditional mechanism we now refer to at Unit Test-Driven Development, or 
UTDD. There are higher-level tests that we can write also, that have the same 
impact on our development process. Applying this same concept of a failing test 
driving us to write code is where this discussion now leads, but at one level of 
abstraction higher. We now look to the Acceptance Criteria to drive our TDD, or 
now ATDD. 
&lt;/font&gt;&lt;br&gt;&lt;br&gt;&lt;!-- BOF buynow --&gt;&lt;!-- EOF buynow --&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;!-- EOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;&lt;/p&gt;
&lt;p&gt;&lt;!-- BOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;&lt;font color="#052230" face="Arial" size="2"&gt;&lt;font color="#052230" face="Arial" size="2"&gt;&lt;img src="/content/binary/ATDDdiagram.gif" border="0" height="561" width="791"&gt;&lt;/font&gt;&lt;/font&gt;&lt;!-- EOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;&lt;/p&gt;
&lt;p&gt;&lt;!-- BOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;
&lt;table border="0" cellpadding="10" cellspacing="0" width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;font color="#052230" face="Arial" size="2"&gt;1. Acceptance Criteria gives us a 
target for writing Automated Acceptance Tests [AAT's] a. Acceptance Criteria 
need to be written into an executable set of automated tests. b. AAT's should be 
able demonstrate to the customer that their criteria for the functionality has 
been met. c. Ideally, this should include as much detail as the requirements 
bear out, and as many tests and checks are necessary to convey that each of the 
criteria has been accounted for. &lt;/font&gt;&lt;br&gt;&lt;br&gt;&lt;!-- BOF buynow --&gt;&lt;!-- EOF buynow --&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;!-- EOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;&lt;/p&gt;
&lt;p&gt;&lt;!-- BOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;
&lt;table border="0" cellpadding="10" cellspacing="0" width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;font color="#052230" face="Arial" size="2"&gt;2. AAT's give us a reason to write 
code (they are failing - no CUT yet) a. AAT's can be written before writing the 
code, or written one at a time following this process. &lt;/font&gt;&lt;br&gt;&lt;br&gt;&lt;!-- BOF buynow --&gt;&lt;!-- EOF buynow --&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;!-- EOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;&lt;/p&gt;
&lt;p&gt;&lt;!-- BOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;
&lt;table border="0" cellpadding="10" cellspacing="0" width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;font color="#052230" face="Arial" size="2"&gt;3. We now write the empty framework 
for the CUT. Some AAT's may still be failing, but that's OK. a. This step 
deviates from strict TDD in that we are writing code, but not for the intent of 
passing a test. b. One example is that if a criteria states that a customer is 
able to bring up a web page with a set of information, obviously we need to 
provide a web page. c. This framework concept is creating the empty page or 
container for the code we are going to write. d. The empty framework should not 
cause AAT's to pass, because AAT's should written to test at a higher level of 
functionality. 
&lt;/font&gt;&lt;br&gt;&lt;br&gt;&lt;!-- BOF buynow --&gt;&lt;!-- EOF buynow --&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;!-- EOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;&lt;/p&gt;
&lt;p&gt;&lt;!-- BOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;
&lt;table border="0" cellpadding="10" cellspacing="0" width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;font color="#052230" face="Arial" size="2"&gt;4. To make the AAT's pass, we need to 
start providing the functionality inside the empty framework. Here we need to 
apply the standard TDD concepts, and write a failing unit test. &lt;/font&gt;&lt;br&gt;&lt;br&gt;&lt;!-- BOF buynow --&gt;&lt;!-- EOF buynow --&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;!-- EOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;&lt;/p&gt;
&lt;p&gt;&lt;!-- BOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;
&lt;table border="0" cellpadding="10" cellspacing="0" width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;font color="#052230" face="Arial" size="2"&gt;5. We now have a failing unit test, so 
we write enough CUT to pass that test. &lt;/font&gt;&lt;br&gt;&lt;br&gt;&lt;!-- BOF buynow --&gt;&lt;!-- EOF buynow --&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;!-- EOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;&lt;/p&gt;
&lt;p&gt;&lt;!-- BOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;
&lt;table border="0" cellpadding="10" cellspacing="0" width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;font color="#052230" face="Arial" size="2"&gt;6. We repeat at step 4, refactor, and 
continue following the UTDD process as described above. &lt;/font&gt;&lt;br&gt;&lt;br&gt;&lt;!-- BOF buynow --&gt;&lt;!-- EOF buynow --&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;!-- EOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;&lt;/p&gt;
&lt;p&gt;&lt;!-- BOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;
&lt;table border="0" cellpadding="10" cellspacing="0" width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;font color="#052230" face="Arial" size="2"&gt;7. When the functionality that the 
AAT's require is there, they will be passing, Unit Tests [UT's] are passing, and 
our story (feature) is complete. We now continue to step 1 again for the next 
story. 
&lt;/font&gt;&lt;br&gt;&lt;br&gt;&lt;!-- BOF buynow --&gt;&lt;!-- EOF buynow --&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;!-- EOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;&lt;/p&gt;
&lt;p&gt;&lt;!-- BOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;
&lt;table border="0" cellpadding="10" cellspacing="0" width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;font color="#052230" face="Arial" size="2"&gt;&lt;font size="2"&gt;&lt;span style="font-weight: bold; font-family: Verdana;"&gt;How do I do it? What do I need 
to get started?&lt;/span&gt;&lt;br style="font-weight: bold; font-family: Verdana;"&gt;&lt;br style="font-family: Verdana;"&gt;&lt;span style="font-family: Verdana;"&gt;Acceptance Test 
Driven Development is a practice that can yield good returns on the time 
invested. Customers will be pleased with the software they receive, bugs will be 
fewer, and delivery times will be shorter. However, there are a few things that 
are needed to make this practice effective in an 
organization.&lt;br&gt;&lt;br&gt;&lt;/span&gt;&lt;/font&gt;
&lt;/font&gt;&lt;ol&gt;&lt;font color="#052230" face="Arial" size="2"&gt;&lt;li&gt;&lt;font size="2"&gt;Buy-in&lt;/font&gt;
&lt;ol&gt;&lt;li&gt;&lt;font size="2"&gt;People must be bought-in to the concept that test driven 
development is a good thing.&lt;/font&gt;
&lt;/li&gt;&lt;li&gt;&lt;font size="2"&gt;Management must support this practice, for if not, it will be a 
much more difficult thing to accomplish.&lt;/font&gt;
&lt;/li&gt;&lt;li&gt;&lt;font size="2"&gt;Developers must be willing to put aside their "classical" 
training and try something new.&lt;br&gt;&lt;/font&gt;&lt;/li&gt;&lt;/ol&gt;
&lt;/li&gt;&lt;li&gt;&lt;font size="2"&gt;Testing Tools&lt;/font&gt;&lt;font color="#052230" face="Arial" size="2"&gt;&lt;/font&gt;
&lt;ol&gt;&lt;li&gt;&lt;font size="2"&gt;If we can't write an automated acceptance test for our product, 
we can't do ATDD. We need a tool designed for testing the particular type of 
product we are shipping.&lt;/font&gt;
&lt;/li&gt;&lt;li&gt;&lt;font size="2"&gt;Story Test IQ [STIQ] is a great tool for automated testing of 
web applications. Straight Selenium RC under C# code, driven by NUnit also works great, in my experience. VSTS has some good tools also, as do Fiddler, and probably 
lots of other products.&lt;/font&gt;
&lt;/li&gt;&lt;li&gt;&lt;font size="2"&gt;The framework must be in place on day 1 of the iteration to 
begin writing acceptance tests. If it isn't available, we won't be able to do 
ATDD.&lt;br&gt;&lt;/font&gt;&lt;/li&gt;&lt;/ol&gt;
&lt;/li&gt;&lt;li&gt;&lt;font size="2"&gt;Skills&lt;/font&gt;
&lt;ol&gt;&lt;li&gt;&lt;font size="2"&gt;Developers need the skills to be able to envision what is to be 
delivered, and be able to write automated test scenarios for the acceptance 
criteria.&lt;br&gt;&lt;/font&gt;
&lt;/li&gt;&lt;li&gt;&lt;font size="2"&gt;Testers need to be able to validate that the tests cover enough 
of the functionality through testing the criteria, and provide other functional, 
integration, load, and performance tests in addition to the developers' unit 
tests and acceptance tests.&lt;br&gt;&lt;/font&gt;
&lt;/li&gt;&lt;li&gt;&lt;font size="2"&gt;Management needs to be able to direct the right resources at 
tasks, no matter whether they are Development or Test tasks. Sometimes it's best 
to blur the lines between the disciplines to make this practice most 
effective.&lt;br&gt;&lt;/font&gt;
&lt;/li&gt;&lt;li&gt;&lt;font size="2"&gt;Customers need to be aware that they are actually going to get 
what they specify (and perhaps ONLY that much). Education on criteria evolution 
is almost always required for customers. Don't be surprised if only 50% of the 
criteria are discovered in sprint planning a&lt;/font&gt;&lt;font size="2"&gt;nd story generation for the first 
couple of iterations.&lt;br&gt;&lt;/font&gt;&lt;/li&gt;&lt;/ol&gt;
&lt;/li&gt;&lt;li&gt;&lt;font size="2"&gt;Experience&lt;/font&gt;
&lt;ol&gt;&lt;li&gt;&lt;font size="2"&gt;TDD takes discipline, and ATDD even more so. This is not a 
practice for an organization just beginning down the road of TDD. Put in at 
least 6 iterations of using strict TDD first before trying ATDD. The experience 
gained with using TDD will naturally flow into ATDD, and the organization and 
the customers will see the benefits.&lt;br&gt;&lt;/font&gt;&lt;/li&gt;&lt;/ol&gt;
&lt;/li&gt;&lt;li&gt;&lt;font size="2"&gt;Perseverance&lt;/font&gt;
&lt;ol&gt;&lt;li&gt;&lt;font size="2"&gt;Good things don't happen instantly. It takes some time to see 
the benefits of ATDD.&lt;/font&gt;
&lt;/li&gt;&lt;li&gt;&lt;font size="2"&gt;Be patient for a few sprints. It should take approximately 
three iterations to get it dialed in.&lt;br&gt;&lt;/font&gt;&lt;/li&gt;&lt;/ol&gt;
&lt;/li&gt;&lt;li&gt;&lt;font size="2"&gt;Customer Cooperation&lt;/font&gt;
&lt;ol&gt;&lt;li&gt;&lt;font size="2"&gt;Customers must be available for providing their criteria for 
acceptance.&lt;/font&gt;
&lt;/li&gt;&lt;li&gt;&lt;font size="2"&gt;Customers generally are not experts in this type of 
"specification" of criteria, and must often be helped through the process at 
first, to generate usable criteria.&lt;br&gt;&lt;/font&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;/font&gt;&lt;/ol&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/p&gt;&lt;img width="0" height="0" src="http://testdrivendeveloper.com/aggbug.ashx?id=9eda991a-3ada-4e70-84d8-1194fa5edda7"/&gt;&lt;/div&gt;</description>
      <comments>http://testdrivendeveloper.com/CommentView,guid,9eda991a-3ada-4e70-84d8-1194fa5edda7.aspx</comments>
      <category>ATDD</category>
      <category>TDD</category>
      <category>Testing</category>
    </item>
    <item>
      <trackback:ping>http://testdrivendeveloper.com/Trackback.aspx?guid=6a38c2cf-ed78-4deb-8ad3-c3f2afa9c38c</trackback:ping>
      <pingback:server>http://testdrivendeveloper.com/pingback.aspx</pingback:server>
      <pingback:target>http://testdrivendeveloper.com/PermaLink,guid,6a38c2cf-ed78-4deb-8ad3-c3f2afa9c38c.aspx</pingback:target>
      <dc:creator>John E. Boal</dc:creator>
      <wfw:comment>http://testdrivendeveloper.com/CommentView,guid,6a38c2cf-ed78-4deb-8ad3-c3f2afa9c38c.aspx</wfw:comment>
      <wfw:commentRss>http://testdrivendeveloper.com/SyndicationService.asmx/GetEntryCommentsRss?guid=6a38c2cf-ed78-4deb-8ad3-c3f2afa9c38c</wfw:commentRss>
      <title>Testing? Aren't I a Developer?</title>
      <guid isPermaLink="false">http://testdrivendeveloper.com/PermaLink,guid,6a38c2cf-ed78-4deb-8ad3-c3f2afa9c38c.aspx</guid>
      <link>http://TestDrivenDeveloper.com/2008/03/24/TestingArentIADeveloper.aspx</link>
      <pubDate>Mon, 24 Mar 2008 05:47:08 GMT</pubDate>
      <description>&lt;div&gt;&lt;p&gt;
&lt;table border="0" cellpadding="10" cellspacing="0" width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;font color="#052230" face="Arial" size="2"&gt;Aren't developers just supposed to 
write their code and let the test team test it? 
&lt;/font&gt;&lt;p&gt;&lt;font color="#052230" face="Arial" size="2"&gt;ahem. 
&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#052230" face="Arial" size="2"&gt;no. 
&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#052230" face="Arial" size="2"&gt;As a developer, I take pride in delivering *working* software. If I don't 
test my own software, I think that I'm really failing to do my job. Testing is 
not just for "testers." 
&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#052230" face="Arial" size="2"&gt;As a professional software engineer, I need have not only unit tests for my 
code (a Development practice by the way), but I also need to write automated 
functional tests to make sure that all the functionality works as I think it 
should. Then, I need to have automated Acceptance tests that tell me if indeed 
the whole system works together to deliver the business solution that the story 
or requirements describe. 
&lt;/font&gt;&lt;br&gt;&lt;br&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;!-- EOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;&lt;/p&gt;
&lt;p&gt;&lt;!-- BOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;
&lt;table border="0" cellpadding="10" cellspacing="0" width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td colspan="2" align="center"&gt;&lt;font color="#96372b" face="Arial" size="+1"&gt;Acceptance 
Tests &lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;font color="#052230" face="Arial" size="2"&gt;Why do I start with acceptance tests? 
&lt;/font&gt;&lt;p&gt;&lt;font color="#052230" face="Arial" size="2"&gt;Because... they should drive the entire development process. Test-Driven 
Development doesn't necessarily have to *always* mean Unit Test-Driven 
Development... 
&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#052230" face="Arial" size="2"&gt;The Acceptance tests drive me to write code.&lt;br&gt;In order to write code, I 
need a unit test.&lt;br&gt;Then I can write the code that passes the unit test and the 
acceptance test.
&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#052230" face="Arial" size="2"&gt;job well done. 
&lt;/font&gt;&lt;br&gt;&lt;br&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;!-- EOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;&lt;/p&gt;
&lt;p&gt;&lt;!-- BOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;
&lt;table border="0" cellpadding="10" cellspacing="0" width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td colspan="2" align="center"&gt;&lt;font color="#96372b" face="Arial" size="+1"&gt;Unit Tests 
&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;font color="#052230" face="Arial" size="2"&gt;I write enough unit tests to be able 
to make sure that the functionality I write works as I intended. Not too many - 
tests require maintenance as well as the code they test - but enough to ensure 
that it's safe to refactor just about anything in the code and make sure that it 
still works as intended. This is the safety net that unit tests provide. 
&lt;/font&gt;&lt;br&gt;&lt;br&gt;&lt;!-- BOF buynow --&gt;&lt;!-- EOF buynow --&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;!-- EOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;&lt;/p&gt;
&lt;p&gt;&lt;!-- BOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;
&lt;table border="0" cellpadding="10" cellspacing="0" width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td colspan="2" align="center"&gt;&lt;font color="#96372b" face="Arial" size="+1"&gt;Code 
&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;font color="#052230" face="Arial" size="2"&gt;Write some. It should make the tests 
pass. Failure is not an option. &lt;/font&gt;&lt;br&gt;&lt;br&gt;&lt;!-- BOF buynow --&gt;&lt;!-- EOF buynow --&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;!-- EOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;&lt;/p&gt;
&lt;p&gt;&lt;!-- BOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;
&lt;table border="0" cellpadding="10" cellspacing="0" width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td colspan="2" align="center"&gt;&lt;font color="#96372b" face="Arial" size="+1"&gt;Functional 
Tests &lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;font color="#052230" face="Arial" size="2"&gt;We need to make sure that all the 
pieces of functionality behave in a known way. This is what functional testing 
does. 
&lt;/font&gt;&lt;p&gt;&lt;br&gt;&lt;br&gt;&lt;!-- BOF buynow --&gt;&lt;!-- EOF buynow --&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;!-- EOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;&lt;/p&gt;
&lt;p&gt;&lt;!-- BOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;
&lt;table border="0" cellpadding="10" cellspacing="0" width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td colspan="2" align="center"&gt;&lt;font color="#96372b" face="Arial" size="+1"&gt;Integration 
Tests &lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;font color="#052230" face="Arial" size="2"&gt;We need to make sure that all the 
systems co-operate. Integration tests are deeper yet than functional tests, 
these are more like "end-to-end" tests of particular scenarios. Usually these 
scenarios cover all the happy paths of end-to-end, and most likely a couple of 
failure scenarios as well, to illustrate how the system overall behaves in 
failure modes. 
&lt;/font&gt;&lt;br&gt;&lt;br&gt;&lt;!-- BOF buynow --&gt;&lt;!-- EOF buynow --&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;!-- EOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;&lt;/p&gt;
&lt;p&gt;&lt;!-- BOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;
&lt;table border="0" cellpadding="10" cellspacing="0" width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td colspan="2" align="center"&gt;&lt;font color="#96372b" face="Arial" size="+1"&gt;Deployment 
Tests &lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;font color="#052230" face="Arial" size="2"&gt;You DID want to INSTALL the software 
and use it, right? 
&lt;/font&gt;&lt;p&gt;&lt;font color="#052230" face="Arial" size="2"&gt;So... you got a test for that? 
&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#052230" face="Arial" size="2"&gt;Sure you do. 
&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#052230" face="Arial" size="2"&gt;Deployment tests are essential for making sure the software delivers and 
configures the binary bits in a way that's useful to the user. Uninstall is a 
particularly critical issue as well. Make sure that you have complete testing 
around these critical fundamental features of the software. &lt;/font&gt;&lt;br&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;img width="0" height="0" src="http://testdrivendeveloper.com/aggbug.ashx?id=6a38c2cf-ed78-4deb-8ad3-c3f2afa9c38c"/&gt;&lt;/div&gt;</description>
      <comments>http://testdrivendeveloper.com/CommentView,guid,6a38c2cf-ed78-4deb-8ad3-c3f2afa9c38c.aspx</comments>
      <category>ATDD</category>
      <category>TDD</category>
      <category>Testing</category>
    </item>
    <item>
      <trackback:ping>http://testdrivendeveloper.com/Trackback.aspx?guid=bacc66cc-3baa-4e1f-bfda-1e2728baca00</trackback:ping>
      <pingback:server>http://testdrivendeveloper.com/pingback.aspx</pingback:server>
      <pingback:target>http://testdrivendeveloper.com/PermaLink,guid,bacc66cc-3baa-4e1f-bfda-1e2728baca00.aspx</pingback:target>
      <dc:creator>John E. Boal</dc:creator>
      <wfw:comment>http://testdrivendeveloper.com/CommentView,guid,bacc66cc-3baa-4e1f-bfda-1e2728baca00.aspx</wfw:comment>
      <wfw:commentRss>http://testdrivendeveloper.com/SyndicationService.asmx/GetEntryCommentsRss?guid=bacc66cc-3baa-4e1f-bfda-1e2728baca00</wfw:commentRss>
      <title>Teaching TDD, and Advancing the Practice</title>
      <guid isPermaLink="false">http://testdrivendeveloper.com/PermaLink,guid,bacc66cc-3baa-4e1f-bfda-1e2728baca00.aspx</guid>
      <link>http://TestDrivenDeveloper.com/2008/03/19/TeachingTDDAndAdvancingThePractice.aspx</link>
      <pubDate>Wed, 19 Mar 2008 05:44:35 GMT</pubDate>
      <description>&lt;div&gt;&lt;h1&gt;&lt;a class="Anchor" name="Advancing the Practice"&gt;&lt;/a&gt;Advancing the 
Practice&lt;/h1&gt;
&lt;p&gt;Better unit testing. Mocks. High code coverage. Fast test suite 
execution.&lt;/p&gt;
&lt;p&gt;What are some of the things we need to get to these goals?&lt;/p&gt;
&lt;h1&gt;&lt;a class="Anchor" name="Teaching TDD"&gt;&lt;/a&gt;Teaching TDD&lt;/h1&gt;




&lt;p&gt;Some developers have an open mind to learn TDD. We need an effective 
mechanism to teach them the skills of how to think test-first in a fairly rapid manner. TDD is not just about test-first, it's about code quality. To ensure code 
quality, we need good tests. If your developers aren't writing good code, chances are they are writing 
even lower quality tests, if any at all. How do we get good quality tests that make sure our code is in good 
shape?&lt;/p&gt;&lt;p&gt;Test authoring, like most things in life, requires skill, and above all - Practice.&lt;br&gt;&lt;/p&gt;&lt;p&gt;Take some well-written unit tests, and go over them with your developers. Teach them about the parts of each test, the setup, the test, and the assertions (and cleanup). Show examples. Have the experienced developers review the unit tests the other developers write. Have your test lead review unit tests too.&lt;br&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;img width="0" height="0" src="http://testdrivendeveloper.com/aggbug.ashx?id=bacc66cc-3baa-4e1f-bfda-1e2728baca00"/&gt;&lt;/div&gt;</description>
      <comments>http://testdrivendeveloper.com/CommentView,guid,bacc66cc-3baa-4e1f-bfda-1e2728baca00.aspx</comments>
      <category>TDD</category>
    </item>
    <item>
      <trackback:ping>http://testdrivendeveloper.com/Trackback.aspx?guid=36f87b85-6fba-404d-86e9-9c069b081688</trackback:ping>
      <pingback:server>http://testdrivendeveloper.com/pingback.aspx</pingback:server>
      <pingback:target>http://testdrivendeveloper.com/PermaLink,guid,36f87b85-6fba-404d-86e9-9c069b081688.aspx</pingback:target>
      <dc:creator>John E. Boal</dc:creator>
      <wfw:comment>http://testdrivendeveloper.com/CommentView,guid,36f87b85-6fba-404d-86e9-9c069b081688.aspx</wfw:comment>
      <wfw:commentRss>http://testdrivendeveloper.com/SyndicationService.asmx/GetEntryCommentsRss?guid=36f87b85-6fba-404d-86e9-9c069b081688</wfw:commentRss>
      <title>ATDD - Acceptance Test Driven Development</title>
      <guid isPermaLink="false">http://testdrivendeveloper.com/PermaLink,guid,36f87b85-6fba-404d-86e9-9c069b081688.aspx</guid>
      <link>http://TestDrivenDeveloper.com/2008/03/14/ATDDAcceptanceTestDrivenDevelopment.aspx</link>
      <pubDate>Fri, 14 Mar 2008 05:39:09 GMT</pubDate>
      <description>&lt;div&gt;&lt;div id="TopicBody"&gt;
&lt;p&gt;Use ATDD as an advanced extension of TDD, keeping the software's development 
guided by the principles of satisfying the customer's needs through acceptance 
criteria and automated testing.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;BDD, ATDD, UTDD, DSL's&lt;/b&gt; ... when will it all end...&lt;/p&gt;
&lt;p&gt;The drive toward business-driven testing has never been stronger. Developers 
are seemingly now finding a higher and higher bar when it comes to customers' 
expectations of quality and features. Our tools are getting better, and we can 
deliver more software, faster. But, our methodologies haven't necessarily 
changed enough to satisfy today's customer expectations.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Enter Business-Driven Design...&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Business driven design is a concept that enables us to take business 
requirements and current priorities and turn them into a software design through 
Acceptance Test-Driven Development. The business requirements that drive the 
need for the software are turned into specific criteria that allow the business 
to decide what the criteria are that will allow them to use a feature and have 
it meet their business need. Rather than the old-school way of gathering 
requirements, and having a requirements document and a functional specification, 
we now turn to individual small criteria that decide if the software is 
acceptable to meet the need. Some of the criteria map directly from functional 
requirements, and others may not have been captured in a traditional 
requirements gathering and specifying model.&lt;/p&gt;
&lt;p&gt;Domain-Specific Languages (DSL's) are key to success in Acceptance 
Test-Driven Development. DSL's give us a way to communicate with the customer 
and domain experts in their terms. When we capture criteria in this manner, it 
becomes quite clear to those with domain knowledge, what is meant and what is 
desired. There is no need for a "translator" between the customer and the 
developers (this used to be called "Business Analyst"). The developers model the 
code in terms of the language the customer already uses. This mechanism leads to 
better communication, better encapsulation, and better object-oriented 
development.&lt;/p&gt;
&lt;p&gt;Acceptance Test-Driven Development [ATDD] gives us a mechanism to use DSL's and direct customer involvement in making sure 
the software we deliver meets the needs. When we take the criteria and turn them 
into automated acceptance tests, it is far easier for the customers to see that 
they are getting what they asked for. It's also easier for the developers to 
have a target to shoot for, and have a goal to meet. This way, they are more 
focused on delivering a specific unit of functionality that the customer needs 
rather than (as so often happens) some "new feature" that they thought might be 
useful.&lt;/p&gt;
&lt;p&gt;Much care needs to be put into the way that acceptance criteria are gathered 
and then automated. If there is something that is missed, it could critically 
affect the design. This is an opportunity for customers and developers to 
collaborate and get it right. The customer needs to understand that if it isn't 
on the acceptance criteria list, it isn't going to be in the software... 
Performance criteria, interoperability with other systems, and other criteria 
like these are often missed. Customers should have many opportunities to review 
and re-review the criteria before they are approved. Even still, sometimes 
things are missed. This is why it is important for the customer to be involved 
at all stages of the development process. The customer shouldn't just be 
involved in the criteria gathering, then come back later for their product. If 
things are missed, they will likely become apparent and turn up in daily work. 
If the customer is there to be consulted, decisions can be made about how to 
integrate missed criteria, and how to capture these better in the future.&lt;/p&gt;
&lt;p&gt;Business-Driven Design is a business-centric, collaborative, agile mechanism 
for delivering quality software to today's demanding customer.&lt;/p&gt;&lt;/div&gt;
&lt;div class="Border" id="RightBorder"&gt;
&lt;table class="TableClass" cellpadding="2" cellspacing="1"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="TableCell" style="white-space: nowrap;" colspan="2"&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;img width="0" height="0" src="http://testdrivendeveloper.com/aggbug.ashx?id=36f87b85-6fba-404d-86e9-9c069b081688"/&gt;&lt;/div&gt;</description>
      <comments>http://testdrivendeveloper.com/CommentView,guid,36f87b85-6fba-404d-86e9-9c069b081688.aspx</comments>
      <category>TDD</category>
      <category>ATDD</category>
    </item>
    <item>
      <trackback:ping>http://testdrivendeveloper.com/Trackback.aspx?guid=5202f2da-3ae9-4d8f-98f9-9413280ff982</trackback:ping>
      <pingback:server>http://testdrivendeveloper.com/pingback.aspx</pingback:server>
      <pingback:target>http://testdrivendeveloper.com/PermaLink,guid,5202f2da-3ae9-4d8f-98f9-9413280ff982.aspx</pingback:target>
      <dc:creator>John E. Boal</dc:creator>
      <wfw:comment>http://testdrivendeveloper.com/CommentView,guid,5202f2da-3ae9-4d8f-98f9-9413280ff982.aspx</wfw:comment>
      <wfw:commentRss>http://testdrivendeveloper.com/SyndicationService.asmx/GetEntryCommentsRss?guid=5202f2da-3ae9-4d8f-98f9-9413280ff982</wfw:commentRss>
      <title>Red, Green, Refactor</title>
      <guid isPermaLink="false">http://testdrivendeveloper.com/PermaLink,guid,5202f2da-3ae9-4d8f-98f9-9413280ff982.aspx</guid>
      <link>http://TestDrivenDeveloper.com/2008/02/12/RedGreenRefactor.aspx</link>
      <pubDate>Tue, 12 Feb 2008 07:17:18 GMT</pubDate>
      <description>&lt;div&gt;&lt;div align="center"&gt;&lt;br&gt;&lt;/div&gt;&lt;table border="0" cellpadding="10" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;
&lt;td colspan="2" align="center"&gt;&lt;div align="center"&gt;&lt;img src="/content/binary/RedGreenRefactor.png" border="0" height="72" width="282"&gt;&lt;/div&gt;&lt;font color="#96372b" face="Arial" size="+1"&gt;RED. Why does it 
have to fail first? &lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;font color="#052230" face="Arial" size="2"&gt;Can't we just skip this step? 
&lt;/font&gt;&lt;p&gt;&lt;font color="#052230" face="Arial" size="2"&gt;&lt;b&gt;Nope.&lt;/b&gt; 
&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#052230" face="Arial" size="2"&gt;We write the test to fail first... because we need to test... the test 
itself! How can we depend on a test that isn't ever going to fail? 
&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#052230" face="Arial" size="2"&gt;Test is failing because there's no code yet. 
&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#052230" face="Arial" size="2"&gt;Write just enough code to make the test pass (hard code the result). 
&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#052230" face="Arial" size="2"&gt;Now that the test is passing, we can refactor. 
&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#052230" face="Arial" size="2"&gt;But... I actually like to take this opportunity to write the next test. 
&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#052230" face="Arial" size="2"&gt;New test is failing because the hard-coded value for the first test doesn't 
work (by design). 
&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#052230" face="Arial" size="2"&gt;NOW... we can refactor. Adding just enough code to make both tests work. Here 
is where we put in the actual work that makes the code function. 
&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#052230" face="Arial" size="2"&gt;Every time we have a new piece of functionality, we write a test. 
&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#052230" face="Arial" size="2"&gt;Our tests will be an "executable" document on how we (programmers) intend the 
code to work. 
&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#052230" face="Arial" size="2"&gt;Even if we didn't get the correct logic to satisfy the requirements (which we 
found out in our Acceptance testing)... At least we know what we intended our 
code to do. &lt;/font&gt;&lt;br&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br&gt;&lt;br&gt;&lt;div align="center"&gt;&lt;font color="#96372b" face="Arial" size="+1"&gt;&amp;nbsp;GREEN - Test Passes!&lt;/font&gt;&lt;br&gt;
&lt;/div&gt;&lt;p&gt;&lt;font color="#052230" face="Arial" size="2"&gt;Now that the test is passing, you're half 
way there. Move on to Refactoring, and keep the test green each time a 
refactoring is completed.&lt;br&gt;&lt;br&gt;BUGS?&lt;br&gt;&lt;br&gt;Got a bug? Great! You're just 
missing a test then...&lt;br&gt;
&lt;p&gt;DON'T JUST FIX IT! That's why bugs come back..&lt;br&gt;&lt;br&gt;TDD: Find a bug 
-&amp;gt;Write a test!&lt;br&gt;&lt;/p&gt;
&lt;p&gt;The test expects the correct behavior... and fails of course! &lt;b&gt;NOW&lt;/b&gt; fix 
the bug ... and the test passes.&lt;br&gt;&lt;/p&gt;
&lt;p&gt;That bug will NEVER be back again because your test will always ensure that 
the code will do the right thing.&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;This is the safety net that TDD, Continuous Integration, and test 
automation give us. We can now refactor mercilessly...&lt;/p&gt;
&lt;p&gt;Onward to Refactoring!&lt;br&gt;&lt;/p&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;table border="0" cellpadding="10" cellspacing="0" width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td colspan="2" align="center"&gt;&lt;font color="#96372b" face="Arial" size="+1"&gt;Refactor 
&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;font color="#052230" face="Arial" size="2"&gt;Use CI tools. Build often. 
&lt;/font&gt;&lt;p&gt;&lt;font color="#052230" face="Arial" size="2"&gt;Change the order of your tests... do they still all run green? &lt;br&gt;Good tests 
are made to be independent. They set-up the system, test it, determine success, 
and then CLEAN UP. Especially if there is an error, CLEAN UP is essential. 
&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#052230" face="Arial" size="2"&gt;Be a good test citizen. Just like when hiking - pack it in, pack it out - 
After the tests run, always make sure leave things as pristine as you found 
them. 
&lt;/font&gt;&lt;br&gt;&lt;br&gt;&lt;!-- BOF buynow --&gt;&lt;!-- EOF buynow --&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;!-- EOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;&lt;/p&gt;
&lt;p&gt;&lt;!-- BOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;
&lt;table border="0" cellpadding="10" cellspacing="0" width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td colspan="2" align="center"&gt;&lt;font color="#96372b" face="Arial" size="+1"&gt;Write tests as 
appropriate &lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;font color="#052230" face="Arial" size="2"&gt;We need to make sure to have adequate 
unit testing. So what does that mean exactly? It depends on the project. 
&lt;br&gt;Some projects will require unit testing for every single control flow, and 
some will only require cursory tests. It may vary even from class to class. 
&lt;br&gt;An example I give is a DTO class (data-transfer object). This class has no 
logic in it, and no functionality - only properties. Do we need to test it? I 
would estimate in most cases - no. If we have an automated tool that generates 
property tests for it, then great, use it. Otherwise I think it's a low test 
risk. Not zero risk though. 
&lt;/font&gt;&lt;p&gt;&lt;font color="#052230" face="Arial" size="2"&gt;Remember when you're so gung-ho about testing that you generate all those 
unit tests... those tests will have to be maintained along with the mainline 
code... Test what makes sense, but don't over-do it. Test maintenance costs time 
and money too. 
&lt;/font&gt;&lt;br&gt;&lt;br&gt;&lt;!-- BOF buynow --&gt;&lt;!-- EOF buynow --&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;!-- EOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;&lt;/p&gt;
&lt;p&gt;&lt;!-- BOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;
&lt;table border="0" cellpadding="10" cellspacing="0" width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;font color="#052230" face="Arial" size="2"&gt;Make small incremental changes. Once 
the method has its functionality completed and the tests are passing, check it 
in! Ideally check-in's to the source repository should occur several times a day 
(perhaps as often as every couple of hours). If there is a code review process 
(and there should be) it should take a very small amount of time to explain and 
review one incremental change. If you're using pair programming (and you should 
try it if you can) then your code has already been reviewed (pairing is also 
called real-time code review), and it's ready to check in as often as every 
half-hour to an hour.&lt;br&gt;&lt;br&gt;There are lots of times when code gets refactored 
from a public method to a private one. Many times there are good reasons to 
combine and refine the internal workings of a public method into a private one. 
Many developers over the years have insisted they should be writing specific 
tests on these private methods.&lt;br&gt;&lt;br&gt;In the .NET world with C#, we can use the 
"internal" keyword rather than private to allow only classes in the assembly to 
access the method. We can also use the .NET "InternalsVisibleTo" attribute to 
allow the test assembly to access the internal methods so they can be tested, 
yet not be accessible publicly.&lt;br&gt;&lt;br&gt;However... if we are using real TDD - 
then the code got written as a result of tests that already exist. So, the 
coverage should remain virtually the same without adding a single new test. And 
that seems like a good plan to me. Plus the whole testing of private methods 
thing is a discussion anyway. &lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;br&gt;&lt;br&gt;&lt;img width="0" height="0" src="http://testdrivendeveloper.com/aggbug.ashx?id=5202f2da-3ae9-4d8f-98f9-9413280ff982"/&gt;&lt;/div&gt;</description>
      <comments>http://testdrivendeveloper.com/CommentView,guid,5202f2da-3ae9-4d8f-98f9-9413280ff982.aspx</comments>
      <category>TDD</category>
    </item>
    <item>
      <trackback:ping>http://testdrivendeveloper.com/Trackback.aspx?guid=01948cfb-2778-4a70-b766-85bc690d660f</trackback:ping>
      <pingback:server>http://testdrivendeveloper.com/pingback.aspx</pingback:server>
      <pingback:target>http://testdrivendeveloper.com/PermaLink,guid,01948cfb-2778-4a70-b766-85bc690d660f.aspx</pingback:target>
      <dc:creator>John E. Boal</dc:creator>
      <wfw:comment>http://testdrivendeveloper.com/CommentView,guid,01948cfb-2778-4a70-b766-85bc690d660f.aspx</wfw:comment>
      <wfw:commentRss>http://testdrivendeveloper.com/SyndicationService.asmx/GetEntryCommentsRss?guid=01948cfb-2778-4a70-b766-85bc690d660f</wfw:commentRss>
      <title>About TestDrivenDeveloper.com</title>
      <guid isPermaLink="false">http://testdrivendeveloper.com/PermaLink,guid,01948cfb-2778-4a70-b766-85bc690d660f.aspx</guid>
      <link>http://TestDrivenDeveloper.com/2008/02/12/AboutTestDrivenDevelopercom.aspx</link>
      <pubDate>Tue, 12 Feb 2008 06:33:29 GMT</pubDate>
      <description>&lt;div&gt;&lt;h2&gt;&lt;font color="#96372b" face="Arial" size="+1"&gt;Test Driven Developer 
&lt;/font&gt;&lt;/h2&gt;
&lt;h3&gt;&lt;img src="/content/binary/USFlag.JPG" border="0" height="285" width="322"&gt;&lt;/h3&gt;&lt;br&gt;&lt;h3&gt;&lt;font color="#000000" face="Arial" size="2"&gt;Assert.AreEqual(13, stripes);&lt;br&gt;Assert.AreEqual(50, stars); 
&lt;br&gt;see&lt;/font&gt;&lt;font color="#000000" face="Arial" size="2"&gt;ms like enough tests to me...&lt;br&gt;&lt;br&gt;NOT! &lt;/font&gt;&lt;/h3&gt;
&lt;p&gt;
&lt;/p&gt;&lt;h2&gt;
&lt;/h2&gt;&lt;p&gt;
&lt;table border="0" cellpadding="10" cellspacing="0" width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;font color="#052230" face="Arial" size="2"&gt;Welcome to Test Driven Developer! This 
site is dedicated to those who understand the benefits of test-first 
development, and the advancement of the practice. &lt;/font&gt;&lt;br&gt;&lt;br&gt;&lt;!-- BOF buynow --&gt;&lt;!-- EOF buynow --&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;!-- EOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;&lt;/p&gt;
&lt;p&gt;&lt;!-- BOF: ./personal-templates/simple/generic/paragraphs/style.1 --&gt;
&lt;table border="0" cellpadding="10" cellspacing="0" width="100%"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&lt;font color="#052230" face="Arial" size="2"&gt;It is sometimes hard to convince 
traditionally trained developers that it is better to write a test first, before 
writing the code. In Test Driven Development, we always write a test first 
before writing the code. 
&lt;/font&gt;&lt;p&gt;&lt;font color="#052230" face="Arial" size="2"&gt;Many developers are hard to convince to use this methodology. It is very 
often difficult for a developer to understand completely what the code needs to 
do. Yet - they want to proceed to write it anyway? It's kind of a flaw in the 
thinking process. 
&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#052230" face="Arial" size="2"&gt;Lucky that you are smart enough to know that there's a better way..&lt;/font&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/p&gt;&lt;font color="#000000" face="Arial" size="2"&gt;TDD is not a Java thing. It's 
not a .NET thing. It's not language dependent. Anyone can do test-first 
development, for literally any kind of software development. 
&lt;/font&gt;&lt;p&gt;&lt;font color="#000000" face="Arial" size="2"&gt;Figuring out the test for some code is always the hard part... that's why we 
like to do it first, and get it out of the way. 
&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#000000" face="Arial" size="2"&gt;TestDrivenDeveloper.com is a &lt;a href="http://johnboal.com" target="_jeb"&gt;John 
E. Boal&lt;/a&gt; web site. Please see also my &lt;a href="http://jboal.com" target="_blog"&gt;personal blog&lt;/a&gt; and my &lt;a href="http://BitsNWidgets.com" target="_bnw"&gt;Agile Development blog&lt;/a&gt; &lt;/font&gt;&lt;/p&gt;&lt;img width="0" height="0" src="http://testdrivendeveloper.com/aggbug.ashx?id=01948cfb-2778-4a70-b766-85bc690d660f"/&gt;&lt;/div&gt;</description>
      <comments>http://testdrivendeveloper.com/CommentView,guid,01948cfb-2778-4a70-b766-85bc690d660f.aspx</comments>
      <category>TDD</category>
      <category>Testing</category>
    </item>
  </channel>
</rss>