[TIP] Difference between functional test and integration test

Daniel Staple -X (dastaple - BSKYB at Cisco) dastaple at cisco.com
Tue Feb 12 03:51:28 PST 2013

My opinion on why the two different types of testing exist:
Unit testing - these being small and quick, should flush out simple logic bombs, and code behaving other than the way you'd expect. Ensure it interacts with stuff at its boundaries the way you thought it would. It doesn't validate any assumptions about the boundaries themselves.

Integration Testing - testing the code with the other involved components is often a slower and more involved process - but ensures the boundary assumptions are correct and that it works in the real world. It can also highlight some areas missing in the unit tests. However, unit tests can prevent logic bombs in the code getting out to this stage - making debugging far easier.

Unit Tests can also be used to provide a context in which to write the code when the boundaries don't exist or cannot yet be in a state to integrate against - with the extreme of this being pure TDD. I do use them sometimes as a scaffold against which to build code. Until integration, this code is only as good as my assumptions about the things it will integrate against - but at least I've validated that the code behaves the way I expect with those assumptions.

From: testing-in-python-bounces at lists.idyll.org [testing-in-python-bounces at lists.idyll.org] on behalf of Tom Davis [tom at recursivedream.com]
Sent: 11 February 2013 15:57
To: John Wong
Cc: testing-in-python at lists.idyll.org
Subject: Re: [TIP] Difference between functional test and integration test

[Auto-Forwarded from NDS]

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

testing-in-python mailing list
testing-in-python at lists.idyll.org

More information about the testing-in-python mailing list