unit test vs functional test code example

Example: unit test vs functional test

Unit Tests are written from a programmers
perspective. It is executed to ensure that
a particular component of an application 
performs a set of specific tasks.

Functional Tests are written from the user
perspective. They ensure that the system
is functioning as users are expecting.
Functional testing is a BlackBox testing
technique that is usually performed by the tester.

Unit Testing of software applications 
is done during the development (coding)
of an application. UNIT Testing is defined
as a type of software testing where
individual units/components of a 
software are tested.