Agile Glossary

Unit Testing

What is Unit Testing?

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’s source code and checks the results. The outcome of a unit test is binary: either “pass” if the program’s behavior is consistent with the recorded expectations, or “fail” otherwise. Developers will typically write a large number of unit tests (corresponding to a large number of program behaviors of interest), called a “test suite”. By common convention dating back at least to the JUnit family of tools, the color red (as in “getting a red bar”) represents the failure of one or more tests. The color green (“a green bar”) denotes the successful execution of “all” unit tests associated with a program.

Also Known As

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 “developer testing”, distinguishing it from “customer testing” and emphasizing the roles responsible for various types of testing.

Common Pitfalls

The shifts in terminology noted above have been the source of much confusion, and debate continues over what “testing” 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 “exploratory” 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 test-driven development.

Expected Benefits

  • a team relying on automated unit tests can expect to reap some of the benefits of test-driven development, in particular, a decrease in defect rates

Origins

  • 1976: a series of articles by D. Panzl describing tools with features closely resembling those of JUnit attest to the long history of automated unit testing
  • 1988-1990: the rise of event-driven GUI software and their specific testing challenges create an opportunity for “capture and replay” test automation tools provided by companies such as Segue or Mercury; this type of tool dominates the market for the next decade
  • 1997: the testing tool JUnit is written by Beck and Gamma, inspired by Beck’s earlier work on SUnit; its growing popularity over the next few years marks the end of the “capture and replay” era.

Join us today!

Agile Alliance offers many online and in-person events and workshops for our members. If you’re not currently a member, you can join now to take advantage of our many members-only resources and programs. LEARN MORE >

Get the latest Agile news!

  • This field is for validation purposes and should be left unchanged.

By subscribing, you acknowledge the Agile Alliance Privacy Policy, and agree to receive our emails.

Additional Agile Glossary Terms

Usability testing is an empirical, exploratory technique to answer questions such as "how would an end user respond to our software under realistic conditions?"
The "role-feature-reason" template is one of the most commonly recommended aids to write user stories: As a ... I want ... So that ...
Sprint planning is an event that occurs at the beginning of a sprint where the team determines the product backlog items they will work on during that sprint and discusses their initial plan for completing those product backlog items.
Three amigos refers to the primary perspectives to examine an increment of work before, during, and after development. Those perspectives are: Business - What problem are we trying to solve? Development - How might we build a solution to solve that problem? Testing - What about this, what could possibly happen?
The team meets regularly to reflect on the most significant events that occurred since the previous such meeting, and identify opportunities for improvement.
Mob Programming is a software development approach where the whole team works on the same thing, at the same time, in the same space, and at the same computer.

Help us keep the definitions updated

Ready to join Agile Alliance?

Unlock members-only access to online learning sessions, Agile resources, annual conference discounts, and more! And when you join, you’ll be supporting our member initiatives, regional events, and global community groups.

Privacy Preference Center

IMPORTANT: We have transitioned to a new membership platform. If you have not already done so, you will need to SET UP AN ACCOUNT on the new platform to establish your user profile. Your previous login credentials will not work until you do this set up.

When you see the login screen, choose “Set up Account” and follow the prompts to create your new account. You can choose to log in using your social credentials for either Google or Linkedin (recommended), or you can set up your account using an email address.