You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
<meta name="description" content="Integration testing determines the correctness for several parts of a system under test at once. Learn more on Full Stack Python.">
<div style="padding: 0 0 20px 0; margin: 0 0 20px 0; background-color: #22B24C;">
<div class="container">
<h2 style="color: #fff; margin: 20px 40px 0 0;"><a href="https://www.gumroad.com/l/python-deployments" style="color: #fff">The Full Stack Python Guide to Deployments book</a> has been released!</h2>
</div>
</div> <a href="https://github.com/makaimc/fullstackpython.com"><img style="position: absolute; top: 0; right: 0; border: 0;" src="/theme/img/fork.png" alt="Fork me on GitHub"></a>
<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 <a href="/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 <a href="/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><a href="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
<a href="http://eigenhombre.com/2013/04/18/thoughts-on-integration-testing/">thoughts on integration testing</a>
and <a href="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 <a href="https://pytest.org/latest/goodpractises.html">integration good practices</a>
that you'll likely want to follow when testing your application.</p>
</li>
<li>
<p><a href="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>
<li>
<p><a href="http://gojko.net/2011/01/12/the-false-dichotomy-of-tests/">The false dichotomy of tests</a>
brings up a good point that tests are code - each one should have a single
purpose, regardless of whether it's a unit or integration test, so
that it's useful for finding defects in the system under test.</p>
</li>
</ul>
<h3>What else do you want to learn about testing?</h3>
<a href="http://www.deploypython.com/"><img src="//static.fullstackpython.com/fsp-deployment-guide.png" alt="The Full Stack Python Guide to Deployments" width="100%"></a>
<p style="font-size: .8em; margin-top: 10px;">Searching for a complete, step-by-step deployment walkthrough? Learn more about <a href="http://www.deploypython.com/">The Full Stack Python Guide to Deployments book</a>.
</p>
</div>
</div> <div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-head"><a href="/table-of-contents.html" style="color: #fff;">Table of Contents</a></h3>
<a href="/about-author.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>About the Author</a>
</div>
</div>
<div class="panel panel-success">
<div class="panel-body">
<a href="http://www.deploypython.com/"><img src="//static.fullstackpython.com/fsp-deployment-guide.png" alt="The Full Stack Python Guide to Deployments" width="100%"></a>
<p style="font-size: .8em; margin-top: 10px;">Searching for a complete, step-by-step deployment walkthrough? Learn more about <a href="http://www.deploypython.com/">The Full Stack Python Guide to Deployments book</a>.