Unit Testing

Unit testing is a method of software testing where individual units of software code are tested to validate whether they are fit for use and if each unit is performing as it should. In most programming languages, the smallest unit that can be isolated is typically a function, subroutine, method, module, or object. Unit testing can save time in the long run by fixing errors on the front end.

the lifecycle of a unit test

Credit: Tutorialspoint.com, “Unit Testing”

Developers conduct unit tests to

  1. Help fix bugs early in the development cycle
  2. Understand the testing code base and make changes quickly
  3. Have a source of project documentation through the unit test for the final deliverable

How to conduct a unit test

To conduct a unit test, a developer will write a section of code to test a specific function in a software application. Unit testing can be done manually or automatically. The manual approach typically requires step-by-step documentation and is no longer commonly used due to the time and effort required.

Using the automated approach, a developer writes a section of code in the application purely to test the function. To ensure the unit test is thorough, the developer will isolate the function to help reveal unnecessary dependencies between the code being tested and other units. When the application is deployed, the test code is removed.

Developers typically use a unit test framework to support test automation and develop automated test cases. From start to finish, a developer creates a test case, reviews and reworks the test, baselines the test by developing automated test cases, and executes the test case.

 

Abby Braden
Abby Braden is an award-winning writer and editor for websites such as TechnologyAdvice.com, Webopedia.com, and Project-Management.com, where she covers technology trends and enterprise and SMB project management platforms. When she’s not writing about technology, she enjoys giving too many treats to her dog and coaching part-time at her local gym.

Top Articles

The Complete List of 1500+ Common Text Abbreviations & Acronyms

Text Abbreviations reviewed by Web Webster   From A3 to ZZZ we list 1,559 SMS, online chat, and text abbreviations to help you translate and understand...

Windows Operating System History & Versions

The Windows operating system (Windows OS) refers to a family of operating systems developed by Microsoft Corporation. We look at the history of Windows...

How to Create a Website Shortcut on Your Desktop

Website Shortcut on Your Desktop reviewed by Web Webster   This Webopedia guide will show you how to create a website shortcut on your desktop using...

Generations of Computers (1st to 5th)

Reviewed by Web Webster Learn about each of the 5 generations of computers and major technology developments that have led to the computing devices that...

Pipeline

A pipeline is a figurative measurement of client or customer progress through a...

Direct Marketing

Direct marketing is a strategy for selling products and services directly...

Compact Disc

A compact disc (CD) is a polycarbonate disc measuring 120 mm in diameter...