From “JUnit in Action”.

1. Logic unit test:

– A test that exercises the code logic by focusing on a single method. You can control the boundaries of given test method using mock objects or stubs.

2. Integration unit test:

– A test that focuses on the integration between components in their real environment ( or part of the real environment ). For example , code that accesses a database has tests that effectively call the database.

3. Functional unit test:

– A test that extend the boundaries of integration unit testing to confirm a stimulus-response. For example, a web application contains a secure web page that only authorized client can access. If the client does not log in, then trying to access the page should result in a redirect to the login page. A functional unit test can examine this case by sending an HTTP request to the page verify the redirect ( HTTP status code 302) response code come back.

Advertisements