<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Object Mentor Blog: TDD with Acceptance Tests and Unit Tests</title>
    <link>http://blog.objectmentor.com/articles/2007/10/17/tdd-with-acceptance-tests-and-unit-tests</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>TDD with Acceptance Tests and Unit Tests</title>
      <description>&lt;p&gt;Test Driven Development is one of the most imperative tenets of Agile Software Development.  It is difficult to claim that you are Agile, if you are not writing lots of automated test cases, and writing them before you write the code that makes them pass.&lt;/p&gt;


	&lt;p&gt;But there are two different kinds of automated tests recommended by the Agile disciplines.  Unit tests, which are written by programmers, for programmers, in a programming language.  And acceptance tests, which are written by business people (and QA), for business people, in a high level specification language (like FitNesse www.fitnesse.org).&lt;/p&gt;


	&lt;p&gt;The question is, how should developers treat these two streams of tests?  What is the process?  Should they write their unit tests and production code first, and then try to get the acceptance tests to pass?  Or should they get the acceptance tests to pass and then backfill with unit tests?&lt;/p&gt;


	&lt;p&gt;And besides, why do we need two streams of tests.  Isn&amp;#8217;t all that testing awfully reduntant?&lt;/p&gt;


	&lt;p&gt;It&amp;#8217;s true that the two streams of tests test the same things.  Indeed, that&amp;#8217;s the point.  Unit tests are written by programers to ensure that the code does what they intend it to do.  Acceptance tests are written by business people (and QA) to make sure the code does what &lt;em&gt;they&lt;/em&gt; intend it to do.  The two together make sure that the business people and programmers intend the same thing.&lt;/p&gt;


	&lt;p&gt;Of course there&amp;#8217;s also a difference in level.  Unit tests reach deep into the code and test independent units.  Indeed, programmers must go to great lengths to decouple the components of the system in order to test them independently.  Therefore unit tests seldom exercise large integrated chunks of the system.&lt;/p&gt;


	&lt;p&gt;Acceptance tests, on the other hand, operate on much larger integrated chunks of the system.  They typically drive the system from it&amp;#8217;s inputs (or a point very close to it&amp;#8217;s inputs) and verify operation from it&amp;#8217;s outputs (or again, very close to it&amp;#8217;s outputs).  So, though the acceptance tests may be testing the same things as the unit tests, the execution pathways are very different.&lt;/p&gt;


	&lt;h2&gt;Process&lt;/h2&gt;


	&lt;p&gt;Acceptance tests should be written at the start of each iteration.  QA and Business analysts should take the stories chosen during the planning meeting, and turn them into automated acceptance tests written in FitNesse, or Selenium or some other appropriate automation tool.&lt;/p&gt;


	&lt;p&gt;The first few acceptance tests should arrive within a day of the planning meeting.  More should arrive each day thereafter.  They should all be complete by the midpoint of the iteration.  If they aren&amp;#8217;t, then some developers should change hats and help the business people finish writing the acceptance tests.&lt;/p&gt;


	&lt;p&gt;Using developers in this way is an automatic safety valve.  If it happens too often, then we need to add more QA or BA resources.  If it never happens, we may need to add more programmers.&lt;/p&gt;


	&lt;p&gt;Programmers use the acceptance tests as requirements.  They read those tests to find out what their stories are &lt;em&gt;really&lt;/em&gt; supposed to do.&lt;/p&gt;


	&lt;p&gt;Programmers start a story by executing the acceptance tests for that story, and noting what fails. Then they write unit tests that force them to write the code that will make some small portion of the acceptance tests pass.  They keep running the acceptance tests to see how much of their story is working, and they keep adding unit tests and production code until all the acceptance tests pass.&lt;/p&gt;


	&lt;p&gt;At the end of the iteration all the acceptance tests (and unit tests) are passing.  There is nothing left for QA to do.  There is no hand-off to QA to make sure the system does what it is supposed to.  The acceptance tests already prove that the system is working.&lt;/p&gt;


	&lt;p&gt;This does not mean that QA does not put their hands on the keyboards and their eyes on the screen.  They do!  But they don&amp;#8217;t follow manual test scripts!  Rather, they perform &lt;em&gt;exploratory testing&lt;/em&gt;.  They get &lt;em&gt;creative&lt;/em&gt;.  They do what QA people are really good at&amp;#8212;they find new and interesting ways to break the system.  They uncover unspecified, or under-specified areas of the system.&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;&lt;span class="caps"&gt;ASIDE&lt;/span&gt;:&lt;/strong&gt; Manual testing is immoral.  Not only is it high stress, tedious, and error prone; it&amp;#8217;s just wrong to turn humans into machines.  If you can write a script for a test procedure, then you can write a program to execute that procedure.  That program will be cheaper, faster, and more accurate than a human, and will free the human to do what humans to best: &lt;em&gt;create!&lt;/em&gt;&lt;/p&gt;


	&lt;p&gt;So, in short, the business specifies the system with automated acceptance tests.  Programmers run those tests to see what unit tests need to be written.  The unit tests force them to write production code that passes both tests.  In the end, all the tests pass.  In the middle of the iteration, QA changes from writing automated tests, to exploratory testing.&lt;/p&gt;</description>
      <pubDate>Wed, 17 Oct 2007 05:50:34 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:726aa984-5062-42df-a89f-4e02601d4f47</guid>
      <author>Uncle Bob</author>
      <link>http://blog.objectmentor.com/articles/2007/10/17/tdd-with-acceptance-tests-and-unit-tests</link>
      <category>Uncle Bob's Blatherings</category>
      <category>Agile Methods</category>
    </item>
    <item>
      <title>"TDD with Acceptance Tests and Unit Tests" by Diego Sacchetto</title>
      <description>&lt;p&gt;One of the differences that Uncle Bob raised is between unit and acceptance testing. They both are automated tests. Manual testing falls under a completely different category and methodology.
Agile promotes automation, after all we are in the software business (which is also an automation tool on its own) therefore everything should be automated as much as possible. How good we are to provide full automation and full coverage for requirements (acceptance tests) and functional logic (unit tests) will determine how much agile we are.
The more we craft the art of automation the more we will replace the manual testing. As humans we don&#226;&#8364;&#8482;t like boring repeated tasks. Think how many times on a straight road with a speed limit, you start your cruise control, simply because it is to boring holding the accelerator and not steering. Moreover people on the robotic industry are trying to design self-driven cars which purpose is to reduce car accidents by eliminating human errors. I do believe manual testing could be removed almost completely no matter the application domain. People are investing a lot of times and energy to provide frameworks to test anything (in the business I work: digital tv applications &#226;&#8364;&#8220; we can automate the actions of a user that is using a remote control. Pretty impressive I would say).
To achieve this goal we must first change the traditional meaning of testing. With Agile (TDD in particular) testing becomes a software development methodology. Therefore, traditionally, a QA person didn&#226;&#8364;&#8482;t need to know to much about programming, but today to write acceptance tests you do need to know how to program and often in the same language that the application is written. But if you follow agile practices then the collaboration between QA and developers is a natural fact.
Let&#226;&#8364;&#8482;s no forget that the ultimate benefit of automation is more appreciated if we introduce the XP practice of continuous integration. 
I agree with Uncle Bob. As humans is more fascinating to study strategic way to work smarter rather then repeating over and over manual tasks. Keeping people self-motivated is the key, and for sure manual testing doesn&#226;&#8364;&#8482;t do that.&lt;/p&gt;</description>
      <pubDate>Tue, 06 Nov 2007 14:56:07 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:910481d1-33a6-4d0b-a694-c51afd88de7d</guid>
      <link>http://blog.objectmentor.com/articles/2007/10/17/tdd-with-acceptance-tests-and-unit-tests#comment-928</link>
    </item>
    <item>
      <title>"TDD with Acceptance Tests and Unit Tests" by Gary Murchison</title>
      <description>&lt;p&gt;So what is the outcome of the outcome of the unspecified / underspecified areas of the system that the &amp;#8220;creative&amp;#8221; tests expose.  Should these be tackled (with new automated acceptance tests) within the same iteration or deferred until a later iteration?&lt;/p&gt;</description>
      <pubDate>Tue, 06 Nov 2007 04:06:54 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:b92c420d-07f6-44b5-a357-5631289d3cfc</guid>
      <link>http://blog.objectmentor.com/articles/2007/10/17/tdd-with-acceptance-tests-and-unit-tests#comment-926</link>
    </item>
    <item>
      <title>"TDD with Acceptance Tests and Unit Tests" by Hans-Eric Gr&#195;&#182;nlund</title>
      <description>&lt;p&gt;Great post, the best I&amp;#8217;ve read on the subject.&lt;/p&gt;


	&lt;p&gt;In my experience it&amp;#8217;s difficult to get business people do programming, even in a high level language such as FitNesse. Therefore, my development team usually helps in the process of designing the acceptance tests, then turn them into automated tests using the same framework as our unit-tests. That process has lots of great side-effects, and it&amp;#8217;s our assurance of quality.&lt;/p&gt;</description>
      <pubDate>Tue, 30 Oct 2007 11:28:25 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:2947ad40-3ab5-40d2-bf22-20785063da3b</guid>
      <link>http://blog.objectmentor.com/articles/2007/10/17/tdd-with-acceptance-tests-and-unit-tests#comment-883</link>
    </item>
    <item>
      <title>"TDD with Acceptance Tests and Unit Tests" by Elisabeth Hendrickson</title>
      <description>&lt;p&gt;Fabulous essay!  I like Ben&amp;#8217;s rephrase to &amp;#8220;Scripted manual testing is immoral.&amp;#8221;  But I&amp;#8217;d actually prefer to see, &amp;#8220;Manual regression testing is immoral.&amp;#8221;  If scripted, it&amp;#8217;s immoral for the originally stated reasons.  If unscripted, it&amp;#8217;s immoral because it&amp;#8217;s not going to provide enough information, fast enough, to support Agility.&lt;/p&gt;</description>
      <pubDate>Sat, 27 Oct 2007 17:18:37 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:7d99f5bd-1b3a-458d-a83c-f7e572c1fe27</guid>
      <link>http://blog.objectmentor.com/articles/2007/10/17/tdd-with-acceptance-tests-and-unit-tests#comment-874</link>
    </item>
    <item>
      <title>"TDD with Acceptance Tests and Unit Tests" by Joe Ocampo</title>
      <description>&lt;p&gt;&amp;gt;Programmers use the acceptance tests as requirements. They read those tests to find out what their stories are really supposed to do.&lt;/p&gt;


	&lt;p&gt;I couldn&amp;#8217;t agree with you more. We recently began the NBehave project to address this very issue. It&amp;#8217;s focus is to drive  the point that in order for a story to be accepted by the development group there must be accompanying acceptance test.&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://www.codeplex.com/NBehave" rel="nofollow"&gt;http://www.codeplex.com/NBehave&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Wed, 24 Oct 2007 22:34:53 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:057cea8e-4bc3-4ab9-b4da-5832f085ec61</guid>
      <link>http://blog.objectmentor.com/articles/2007/10/17/tdd-with-acceptance-tests-and-unit-tests#comment-873</link>
    </item>
    <item>
      <title>"TDD with Acceptance Tests and Unit Tests" by Dean Wampler</title>
      <description>&lt;p&gt;@Peter,&lt;/p&gt;


	&lt;p&gt;You&amp;#8217;re right. The term &amp;#8220;bake test&amp;#8221; is a better term for the kind of test I was describing. &amp;#8220;Smoke test&amp;#8221; is a better term for the fast tests that find obvious problems quickly, as you said.&lt;/p&gt;</description>
      <pubDate>Fri, 19 Oct 2007 12:43:50 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:225c36a8-f41a-4d8c-9442-10cf7da2eb22</guid>
      <link>http://blog.objectmentor.com/articles/2007/10/17/tdd-with-acceptance-tests-and-unit-tests#comment-870</link>
    </item>
    <item>
      <title>"TDD with Acceptance Tests and Unit Tests" by Gary Williams</title>
      <description>&lt;p&gt;I have to disagree to some extent.  In order for the business user to accept that the tests written actually reflect reality, the tests themselves must be tested.  So automated tests aren&amp;#8217;t, &lt;strong&gt;by themselves&lt;/strong&gt;, sufficient proof that the application is correct and meets the requirements, especially if coded by the same developers.  They do facilitate regression and, once the application has passed initial testing, make any retesting trivial.  I have been bitten by developers making hidden (and different) assumptions than the testers about what something means resulting in a green test when things are still wrong.&lt;/p&gt;


	&lt;p&gt;Of course, this would not be a case where there would be a script anyway, since presumably a new/changed feature would need a new/changed script.&lt;/p&gt;</description>
      <pubDate>Fri, 19 Oct 2007 11:58:33 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:f281db78-8467-4f60-b0d4-ae7425e54209</guid>
      <link>http://blog.objectmentor.com/articles/2007/10/17/tdd-with-acceptance-tests-and-unit-tests#comment-869</link>
    </item>
    <item>
      <title>"TDD with Acceptance Tests and Unit Tests" by unclebob</title>
      <description>&lt;p&gt;Ben,&lt;/p&gt;


	&lt;p&gt;Correction accepted.  &lt;em&gt;Scripted&lt;/em&gt; manual testing is immoral.&lt;/p&gt;</description>
      <pubDate>Thu, 18 Oct 2007 16:10:43 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:f413e09f-1053-4d93-8bb2-2b81d3d7da0e</guid>
      <link>http://blog.objectmentor.com/articles/2007/10/17/tdd-with-acceptance-tests-and-unit-tests#comment-868</link>
    </item>
    <item>
      <title>"TDD with Acceptance Tests and Unit Tests" by Ben Simo</title>
      <description>&lt;p&gt;Bob,&lt;/p&gt;


	&lt;p&gt;You had me until &amp;#8220;Manual testing is immoral.&amp;#8221;  This is wrong&amp;#8212;and it doesn&amp;#8217;t jive with the previous paragraph about exploratory testing.&lt;/p&gt;


	&lt;p&gt;Scripted manual testing that is high stress and tedious may be immoral.  But including no manual testing may also be immoral.&lt;/p&gt;


	&lt;p&gt;People and machines have different strengths and weaknesses.  Good manual testing does what people do better than computers.  Good automated testing does what computers do better than people.  Making people work like machines or expecting machines to think and create like people is wrong.&lt;/p&gt;


	&lt;p&gt;Manual testing is error prone, but so is automation&amp;#8212;because it is developed by us fallible humans.  A human tester may make a mistake once and it impacts a single test execution.  A human test coded may make a mistake once at it will impact all executions of that test until the mistake is recognized and fixed.  Maybe we should practice TDD for developing our TDD tests, and TDD for the tests that test our tests, and &amp;#8230; :P&lt;/p&gt;</description>
      <pubDate>Wed, 17 Oct 2007 20:55:57 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:08167747-e82b-4a4d-b46e-9292caeabc8b</guid>
      <link>http://blog.objectmentor.com/articles/2007/10/17/tdd-with-acceptance-tests-and-unit-tests#comment-864</link>
    </item>
    <item>
      <title>"TDD with Acceptance Tests and Unit Tests" by Peter Wood</title>
      <description>&lt;p&gt;@Dean Wampler&lt;/p&gt;


	&lt;p&gt;I take &amp;#8216;smoke tests&amp;#8217; to be a basic, small, base line set of tests which, if they can&amp;#8217;t be run, indicate that no further tests need to be run until some serious issues are sorted out. e.g. the environment isn&amp;#8217;t set up correctly.&lt;/p&gt;</description>
      <pubDate>Wed, 17 Oct 2007 16:40:51 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:bea40225-e5e9-43ab-82b6-7b3acb5ae710</guid>
      <link>http://blog.objectmentor.com/articles/2007/10/17/tdd-with-acceptance-tests-and-unit-tests#comment-863</link>
    </item>
    <item>
      <title>"TDD with Acceptance Tests and Unit Tests" by David Chelimsky</title>
      <description>&lt;p&gt;Bob &amp;#8211; I did read that, but lost it in the shadows of &amp;#8220;Manual testing is immoral,&amp;#8221; which reads (to me) as all-encompassing.&lt;/p&gt;


	&lt;p&gt;Thanks for the clarification.&lt;/p&gt;</description>
      <pubDate>Wed, 17 Oct 2007 14:15:11 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:5886c1e0-525c-40a5-a18a-86dc040d6371</guid>
      <link>http://blog.objectmentor.com/articles/2007/10/17/tdd-with-acceptance-tests-and-unit-tests#comment-862</link>
    </item>
    <item>
      <title>"TDD with Acceptance Tests and Unit Tests" by Dean Wampler</title>
      <description>&lt;p&gt;I like to point out that the &amp;#8220;redundant&amp;#8221; coverage from unit and acceptance tests is like the security philosophy of &lt;em&gt;defense in depth&lt;/em&gt;. You&amp;#8217;re safer if you&amp;#8217;re not relying on just one &amp;#8220;thing&amp;#8221;.&lt;/p&gt;


	&lt;p&gt;That&amp;#8217;s not the primary reason for doing the two kinds of testing, of course, but it is an important benefit.&lt;/p&gt;


	&lt;p&gt;IMHO, the role of QA as the driver of the acceptance tests isn&amp;#8217;t getting as much attention as it deserves. Too many organizations that are adopting the developer practices like test-driven unit tests still have old-style requirements documents and &amp;#8220;passive&amp;#8221; QA teams that only get involved at the end of the process. QA has always been the natural advocate between the customer&amp;#8217;s requirements and the technology that implements them. QA-driven ATs really emphasize that role!&lt;/p&gt;


	&lt;p&gt;Finally, a particular kind of load test worth mentioning is the &amp;#8220;smoke test&amp;#8221;, where the system is run under a simulated load, hopefully on a near-production configuration, for some multiple of days to see what melts down.&lt;/p&gt;</description>
      <pubDate>Wed, 17 Oct 2007 11:19:49 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:2af9be51-92d7-46a6-a8cd-e0f6dfe272ef</guid>
      <link>http://blog.objectmentor.com/articles/2007/10/17/tdd-with-acceptance-tests-and-unit-tests#comment-861</link>
    </item>
    <item>
      <title>"TDD with Acceptance Tests and Unit Tests" by unclebob</title>
      <description>&lt;p&gt;Agreed.  (As I said in the original article ;-)&lt;/p&gt;</description>
      <pubDate>Wed, 17 Oct 2007 10:50:52 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:1090c5ef-3c90-4c6f-bb02-8af41c44f089</guid>
      <link>http://blog.objectmentor.com/articles/2007/10/17/tdd-with-acceptance-tests-and-unit-tests#comment-860</link>
    </item>
    <item>
      <title>"TDD with Acceptance Tests and Unit Tests" by David Chelimsky</title>
      <description>&lt;p&gt;I agree that manual testing as your sole source of testing is immoral.&lt;/p&gt;


	&lt;p&gt;I think, however, that manual exploratory testing is a great way to expose holes in automated test suites.&lt;/p&gt;


	&lt;p&gt;WDYT?&lt;/p&gt;</description>
      <pubDate>Wed, 17 Oct 2007 10:12:58 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:90fcfd50-f89a-46b5-a183-523a402e1b92</guid>
      <link>http://blog.objectmentor.com/articles/2007/10/17/tdd-with-acceptance-tests-and-unit-tests#comment-859</link>
    </item>
    <item>
      <title>"TDD with Acceptance Tests and Unit Tests" by Christopher Gardner</title>
      <description>&lt;p&gt;James Shore has an interesting article favoring Fit as an analysis and communication tool over an executable specification.&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://www.jamesshore.com/Blog/Five-Ways-to-Misuse-Fit.html" rel="nofollow"&gt;http://www.jamesshore.com/Blog/Five-Ways-to-Misuse-Fit.html&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Wed, 17 Oct 2007 09:08:36 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:65c591f0-31ae-4bf0-a246-9844e0d45f36</guid>
      <link>http://blog.objectmentor.com/articles/2007/10/17/tdd-with-acceptance-tests-and-unit-tests#comment-858</link>
    </item>
    <item>
      <title>"TDD with Acceptance Tests and Unit Tests" by Sebastian K&#195;&#188;beck</title>
      <description>&lt;p&gt;There&amp;#8217;s actually more to do for QA people than extending acceptance tests to expose bugs:&lt;/p&gt;


	&lt;p&gt;Write Load Tests (and make sure that they&amp;#8217;re run periodically) to make sure that the performance requirements are met. It&amp;#8217;s also one of the few possibilities to expose concurrency issues.&lt;/p&gt;


	&lt;p&gt;Write Security Tests: Tests that mimic an intruder that attacks potential security holes (e.g. injection, XSS attacks etc.).&lt;/p&gt;</description>
      <pubDate>Wed, 17 Oct 2007 06:24:16 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:696d6268-02df-4c84-818b-a797abcd2b72</guid>
      <link>http://blog.objectmentor.com/articles/2007/10/17/tdd-with-acceptance-tests-and-unit-tests#comment-857</link>
    </item>
  </channel>
</rss>
