Top-rated recipes tagged "tests"http://code.activestate.com/recipes/tags/tests/top/2014-04-24T08:52:32-07:00ActiveState Code RecipesPython Unittest - Obtain the results of all the tests run as a list (Python)
2014-04-24T08:52:32-07:00Cosmin Niculaehttp://code.activestate.com/recipes/users/4189842/http://code.activestate.com/recipes/578866-python-unittest-obtain-the-results-of-all-the-test/
<p style="color: grey">
Python
recipe 578866
by <a href="/recipes/users/4189842/">Cosmin Niculae</a>
(<a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/run/">run</a>, <a href="/recipes/tags/tests/">tests</a>, <a href="/recipes/tags/unittest/">unittest</a>).
Revision 2.
</p>
<p>So far, there is no way of returning the results of the tests run with unittest in any form, except for having the results printed. The purpose of this code is to have the name of the test cases, their indexes, as well as the results (Pass, Fail, Error) as a list. This is extremely used when you want to create a table with the results, as it has all the information needed. </p>
<p>The affected file is the result.py in the unittest library folder.</p>