Test - Unit Test

Generally, in xUnit framework, a test is a function with one assertion.

A test is just a sort of IF statement written in a method. A lot of framework use a collection of assertion method.

Example:

assertEquals(object1, object2)

Tests Make Software.

If you haven't seen a test fail, you don't know if the test works.

• You can write a test once and run it as often as necessary without any additional cost.
• drive the design of software, known as test-driven design

Whenever you are tempted to type something into a print statement or a debugger expression, write it as a test instead. Martin Fowler

Unit Tests are primarily written as a good practice to help developers identify and fix bugs, to refactor code and to serve as documentation for a unit of software under test. To achieve these benefits, unit tests ideally should cover all the possible paths in a program. One unit test usually covers one specific path in one function or method. However a test method is not necessary an encapsulated, independent entity. Often there are implicit dependencies between test methods, hidden in the implementation scenario of a test. Adrian Kuhn et. al.