<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"><head><meta content="text/html; charset=utf-8" http-equiv="Content-Type"/> <link href="../01-bootstrap.min.css" type="text/css" rel="StyleSheet"/> <link href="../02-docstyle.css" type="text/css" rel="StyleSheet"/> <link href="../syntax.css" type="text/css" rel="StyleSheet"/> <title>mitmproxy 0.9 - Testing</title></head><body><div class="navbar navbar-fixed-top"> <div class="navbar-inner"> <div class="container"> <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </a> <a class="brand" href="../index.html">mitmproxy 0.9 docs</a> </div><!--/.nav-collapse --> </div> </div> </div> <div class="container"> <div class="row"> <div class="span3"> <div class="well sidebar-nav"> <ul class="nav nav-list"> <li><a href="../index.html">Introduction</a></li> <li><a href="../install.html">Installation</a></li> <li><a href="../howmitmproxy.html">How mitmproxy works</a></li> <li class="nav-header">Tools</li> <li><a href="../mitmproxy.html">mitmproxy</a></li> <li><a href="../mitmdump.html">mitmdump</a></li> <li class="nav-header">Features</li> <li><a href="../features/anticache.html">Anticache</a></li> <li><a href="../features/clientreplay.html">Client-side replay</a></li> <li><a href="../features/filters.html">Filter expressions</a></li> <li><a href="../features/proxyauth.html">Proxy Authentication</a></li> <li><a href="../features/replacements.html">Replacements</a></li> <li><a href="../features/serverreplay.html">Server-side replay</a></li> <li><a href="../features/setheaders.html">Set Headers</a></li> <li><a href="../features/sticky.html">Sticky cookies and auth</a></li> <li><a href="../features/reverseproxy.html">Reverse proxy mode</a></li> <li><a href="../features/upstreamcerts.html">Upstream Certs</a></li> <li class="nav-header">Installing Certificates</li> <li><a href="../ssl.html">Overview</a></li> <li><a href="../certinstall/firefox.html">Firefox</a></li> <li><a href="../certinstall/osx.html">OSX</a></li> <li><a href="../certinstall/windows7.html">Windows 7</a></li> <li><a href="../certinstall/ios.html">IOS</a></li> <li><a href="../certinstall/ios-simulator.html">IOS Simulator</a></li> <li><a href="../certinstall/android.html">Android</a></li> <li class="nav-header">Transparent Proxying</li> <li><a href="../transparent.html">Overview</a></li> <li><a href="../transparent/linux.html">Linux</a></li> <li><a href="../transparent/osx.html">OSX</a></li> <li class="nav-header">Tutorials</li> <li><a href="../tutorials/30second.html">Client playback: a 30 second example</a></li> <li><a href="../tutorials/gamecenter.html">Setting highscores on Apple's GameCenter</a></li> <li class="nav-header">Scripting mitmproxy</li> <li><a href="../scripting/inlinescripts.html">Inline Scripts</a></li> <li><a href="../scripting/libmproxy.html">libmproxy</a></li> <li class="nav-header">Hacking</li> <li class="active"><a href="testing.html">Testing</a></li> </ul> </div> </div> <div class="span9"> <div class="page-header"> <h1>Testing</h1> </div> <p>All the mitmproxy projects strive to maintain 100% code coverage. In general, patches and pull requests will be declined unless they're accompanied by a suitable extension to the test suite. </p> <p>Our tests are written for the <a href="https://nose.readthedocs.org/en/latest/">nose</a>. At the point where you send your pull request, a command like this:</p> <pre class="terminal"> > nosetests --with-cov --cov-report term-missing ./test </pre> <p>Should give output something like this:</p> <pre class="terminal"> > ---------- coverage: platform darwin, python 2.7.2-final-0 -- > Name Stmts Miss Cover Missing > ---------------------------------------------------- > libmproxy/__init__ 0 0 100% > libmproxy/app 4 0 100% > libmproxy/cmdline 100 0 100% > libmproxy/controller 69 0 100% > libmproxy/dump 150 0 100% > libmproxy/encoding 39 0 100% > libmproxy/filt 201 0 100% > libmproxy/flow 891 0 100% > libmproxy/proxy 427 0 100% > libmproxy/script 27 0 100% > libmproxy/utils 133 0 100% > libmproxy/version 4 0 100% > ---------------------------------------------------- > TOTAL 2045 0 100% > ---------------------------------------------------- > Ran 251 tests in 11.864s </pre> <p>There are exceptions to the coverage requirement - for instance, much of the console interface code can't sensibly be unit tested. These portions are excluded from coverage analysis either in the <strong>.coveragerc</strong> file, or using <strong>#pragma no-cover</strong> directives. To keep our coverage analysis relevant, we use these measures as sparingly as possible.</p> </div> </div> <hr> <footer> <p>© mitmproxy project, 2013</p> </footer> </div> </body></html>