[TIP] Difference between functional test and integration test

Tom Davis tom at recursivedream.com
Mon Feb 11 07:57:39 PST 2013

John Wong writes:

> I am posting the same exact question on Stackexchange:
> http://programmers.stackexchange.com/questions/186523/difference-between-functional-test-and-integration-test
> It's more nicely formatted. I have posted on here before on using mock so I
> figure I can try here as well (and people on this mailinglist are usually
> really really experienced programmers!)
> That being said, I really have a hard time differentiating functional test
> from integration test.

I've always really liked the Pyramid docs' explanation:

Unit testing is, not surprisingly, the act of testing a “unit” in your
application. In this context, a “unit” is often a function or a method
of a class instance. The unit is also referred to as a “unit under

The goal of a single unit test is to test only some permutation of the
“unit under test”. If you write a unit test that aims to verify the
result of a particular codepath through a Python function, you need only
be concerned about testing the code that lives in the function body
itself. If the function accepts a parameter that represents a complex
application “domain object” (such as a resource, a database connection,
or an SMTP server), the argument provided to this function during a unit
test need not be and likely should not be a “real” implementation
object. For example, although a particular function implementation may
accept an argument that represents an SMTP server object, and the
function may call a method of this object when the system is operating
normally that would result in an email being sent, a unit test of this
codepath of the function does not need to test that an email is actually
sent. It just needs to make sure that the function calls the method of
the object provided as an argument that would send an email if the
argument happened to be the “real” implementation of an SMTP server

An integration test, on the other hand, is a different form of testing
in which the interaction between two or more “units” is explicitly
tested. Integration tests verify that the components of your application
work together. You might make sure that an email was actually sent in an
integration test.

A functional test is a form of integration test in which the application
is run “literally”. You would have to make sure that an email was
actually sent in a functional test, because it tests your code end to


> Sidenote: I understand people use different terms in different organization
> (ex. at Google they use small, medium and large instead of unittest, and
> integration test), but for most organizations, they enjoy using "standard
> terms".
> Thanks!
> Yeukhon
> _______________________________________________
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> http://lists.idyll.org/listinfo/testing-in-python

More information about the testing-in-python mailing list