Definition of Unit-Test

This small tip shall remind you what a Unit-Test is and why it is called a Unit-Test

A Unit-Test tests the atomic Code-Unit.

In procedural programming languages these are procedures and functions.

In object-orientierted languages these are static and non-static methods.

Most of the Unit-Test-Frameworks use one test-class (or fixture) with several test-methods per productive class.

Often one productive method is tested by several test-methods.

But: Within the execution of one test-method, only one productive method may be executed!

This is also true for parameterized test-methods, which are executed several time by the framework with different parameter-values of course.

Methods, which would be called by the productive method must be substituted by mock-methods.

See also: stubs, spies, fakes and verification-mocks