<metaname="description" content="Integration testing determines the correctness for several parts of a system under test at once. Learn more on Full Stack Python.">
<linkrel="shortcut icon" href="/img/fsp-fav.png">
<title>Integration Testing - Full Stack Python</title>
<p>Integration testing exercises two or more parts of an application at once,
including the interactions between the parts, to determine if they function
as intended. This type of <ahref="/testing.html">testing</a> identifies defects in
the interfaces between disparate parts of a codebase as they invoke
each other and pass data between themselves.</p>
<h2>How is integration testing different from unit testing?</h2>
<p>While <ahref="/unit-testing.html">unit testing</a> is used to find bugs in individual
functions, integration testing tests the system as a whole. These two
approaches should be used together, instead of doing just one approach over
the other. When a system is comprehensively unit tested, it makes
integration testing far easier because many of the bugs in the individual
components will have already been found and fixed. </p>
<p>As a codebase scales up, both unit and integration testing allow
developers to quickly identify breaking changes in their code. Many times
these breaking changes are unintended and wouldn't be known about until
later in the development cycle, potentially when an end user discovers
the issue while using the software. Automated unit and integration tests
greatly increase the likelihood that bugs will be found as soon as possible
during development so they can be addressed immediately.</p>
<h3>Integration testing resources</h3>
<ul>
<li>
<p><ahref="http://eigenhombre.com/2013/04/13/integration-testing-in-python-with-context-managers/">Integration testing with Context Managers</a>
gives an example of a system that needs integration tests and shows how
context managers can be used to address the problem. There are a couple
other useful posts in this series on testing including
<ahref="http://eigenhombre.com/2013/04/18/thoughts-on-integration-testing/">thoughts on integration testing</a>
and <ahref="http://eigenhombre.com/2013/04/19/processes-vs-threads-for-testing/">processes vs. threads for integration testing</a>.</p>
</li>
<li>
<p>Pytest has a page on <ahref="https://pytest.org/latest/goodpractices.html">integration good practices</a>
that you'll likely want to follow when testing your application.</p>
</li>
<li>
<p><ahref="http://enterprisecraftsmanship.com/2015/07/13/integration-testing-or-how-to-sleep-well-at-nights/">Integration testing, or how to sleep well at night</a>
explains what integration tests are and gives an example. The example is
coded in Java but still relevant when you're learning about integration
testing.</p>
</li>
</ul>
<h3>What else do you want to learn about testing?</h3>
<ahref="http://www.deploypython.com/"><imgsrc="/img/sponsored/fsp-deployment-guide.png" alt="The Full Stack Python Guide to Deployments" width="100%"></a>
<pstyle="font-size: .8em; margin-top: 10px;">Searching for a complete, step-by-step deployment walkthrough? Learn more about <ahref="http://www.deploypython.com/">The Full Stack Python Guide to Deployments book</a>.
<ahref="/what-full-stack-means.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>9. Meta</a><ahref="/table-of-contents.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",san-serif;background-color:#22B24C; color: #fff;'>...or <spanstyle="border-bottom: 1px dotted;">view the full table of contents</span>.</a>
</div>
</div></div></div>
<hr/>
</div>
<divstyle="padding: 0 0 20px 0; margin: 0 0 20px 0; background-color: #22B24C;">
<divclass="container">
<pclass="banner"><ahref="https://www.gumroad.com/l/python-deployments" style="color: #fff">Learning web development? Check out The Full Stack Python Guide to Deployments book</a>!</p>