What is unit testing?

Unit testing is a common practice in programming which tests the functionality of a unit, which is the smallest piece of code that can be produced. Typically this is something simple like a function, method, or property. This allows developers to make sure that their unit will function properly when incorporated into other code.

What is test driven development?

Test driven development is a technique used by programmers where you must first write a test that fails before you write a function that solves that test. This ensures that the code that is written solves the problem written in the test. After passing the test, another test is written and the cycle continues.

Why would you practice test driven development?

A main reason for practicing test driven development is to make sure that each unit of code is functioning properly independently of other code. This allows for an easier debugging process and helps developers to write simpler, more concise code.

What are the advantages and disadvantages of test driven development?

Some advantages to test driven development are:

  • neater code
  • more focused code
  • fewer bugs
  • more documentation
  • easier to maintain

Some disadvantages to test driven development are:

  • it’s a slow process
  • tests must be maintained when changes are made

What is a unit?

A unit can properly be defined as a small piece of code that is responsible for the execution of a specific task. This could include a function, method, or parameter.