{"id":5003453,"date":"2015-12-17T01:03:37","date_gmt":"2015-12-17T09:03:37","guid":{"rendered":"https:\/\/aadev22.local\/?post_type=aa_glossary&#038;p=5003453"},"modified":"2022-08-30T12:12:15","modified_gmt":"2022-08-30T19:12:15","slug":"unit-test","status":"publish","type":"aa_glossary","link":"https:\/\/agilealliance.org\/glossary\/unit-test\/","title":{"rendered":"Unit Testing"},"content":{"rendered":"<div>\n<div>\n<p>A unit test, as Agile teams understand the term, is a short program fragment written and maintained by the developers on the product team, which exercises some narrow part of the product\u2019s source code and checks the results. The outcome of a unit test is binary: either \u201cpass\u201d if the program\u2019s behavior is consistent with the recorded expectations, or \u201cfail\u201d otherwise. Developers will typically write a large number of unit tests (corresponding to a large number of program behaviors of interest), called a \u201ctest suite\u201d. By common convention dating back at least to the\u00a0<a href=\"http:\/\/junit.org\/\">JUnit<\/a> family of tools, the color red (as in \u201cgetting a red bar\u201d) represents the failure of one or more tests. The color green (\u201ca green bar\u201d) denotes the successful execution of \u201call\u201d unit tests associated with a program.<\/p>\n<h2>Also Known As<\/h2>\n<p>The term Unit Testing has a different meaning in the industry, denoting an activity or phase in the classical Software Development Life Cycle, which distinguishes it from (for instance) System Testing. These terms do not necessarily imply anything about automation. To avoid creating confusion, some Agile authors have therefore advocated using the term \u201cdeveloper testing\u201d, distinguishing it from \u201ccustomer testing\u201d and emphasizing the roles responsible for various types of testing.<\/p>\n<h2>Common Pitfalls<\/h2>\n<p>The shifts in terminology noted above have been the source of much confusion, and debate continues over what \u201ctesting\u201d means in Agile teams. Agile has led to a strong emphasis, among developers, on the use of automated checking procedures, and this has tended to marginalize other forms of testing, in particular, that done by professional testers. Yet this work (which some Agile teams call \u201c<a href=\"http:\/\/guide.agilealliance.org\/guide\/exploratory.html\">exploratory<\/a>\u201d testing) is no less important in an Agile context. Also keep in mind the distinction between the practice of automated unit testing, used by developers to check their own code, and the more structured and more constraining practice of\u00a0<a href=\"http:\/\/guide.agilealliance.org\/guide\/tdd.html\">test-driven development<\/a>.<\/p>\n<h2>Expected Benefits<\/h2>\n<ul>\n<li>a team relying on automated unit tests can expect to reap some of the benefits of\u00a0<a href=\"http:\/\/guide.agilealliance.org\/guide\/tdd.html\">test-driven development<\/a>, in particular, a decrease in defect rates<\/li>\n<\/ul>\n<h2>Origins<\/h2>\n<ul>\n<li>1976: a series of articles by D. Panzl describing\u00a0<a href=\"http:\/\/portal.acm.org\/citation.cfm?id=807721\">tools with features closely resembling those of JUnit<\/a>\u00a0attest to the long history of automated unit testing<\/li>\n<li>1988-1990: the rise of event-driven GUI software and their specific testing challenges create an opportunity for \u201ccapture and replay\u201d test automation tools provided by companies such as Segue or Mercury; this type of tool dominates the market for the next decade<\/li>\n<li>1997: the testing tool JUnit is written by Beck and Gamma, inspired by Beck\u2019s earlier work on SUnit; its growing popularity over the next few years marks the end of the \u201ccapture and replay\u201d era.<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<div>\n<div><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>A unit test is a short program fragment which exercises some narrow part of the product&#8217;s source code and checks the results. <\/p>\n","protected":false},"author":8027401,"featured_media":8067461,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","categories":[906],"tags":[],"class_list":["post-5003453","aa_glossary","type-aa_glossary","status-publish","has-post-thumbnail","hentry","category-technology"],"acf":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/agilealliance.org\/wp-json\/wp\/v2\/aa_glossary\/5003453","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/agilealliance.org\/wp-json\/wp\/v2\/aa_glossary"}],"about":[{"href":"https:\/\/agilealliance.org\/wp-json\/wp\/v2\/types\/aa_glossary"}],"author":[{"embeddable":true,"href":"https:\/\/agilealliance.org\/wp-json\/wp\/v2\/users\/8027401"}],"replies":[{"embeddable":true,"href":"https:\/\/agilealliance.org\/wp-json\/wp\/v2\/comments?post=5003453"}],"version-history":[{"count":0,"href":"https:\/\/agilealliance.org\/wp-json\/wp\/v2\/aa_glossary\/5003453\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/agilealliance.org\/wp-json\/wp\/v2\/media\/8067461"}],"wp:attachment":[{"href":"https:\/\/agilealliance.org\/wp-json\/wp\/v2\/media?parent=5003453"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/agilealliance.org\/wp-json\/wp\/v2\/categories?post=5003453"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/agilealliance.org\/wp-json\/wp\/v2\/tags?post=5003453"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}