Unittest presents only total time spent on running all tests but does not present time spent on each test separately.
How to add timing of each test when using unittest?
Join Stack Overflow to learn, share knowledge, and build your career.
|
Unittest presents only total time spent on running all tests but does not present time spent on each test separately. How to add timing of each test when using unittest? |
||||
|
|
|
I suppose, that it's not possible for now: http://bugs.python.org/issue4080. But you can do something like this:
Result:
|
|||||||||||||
|
|
Nose tests with the pinnochio extension has a stopwatch option which will give you this, if nose is an option for you. It also has a ton of other useful features and plugins to make using unittest nicer. |
|||
|
|
|
Here is variation of script from horejsek's answer. It will monkey-patch django TestCase so that every TestCase will give its total running time. You can place this sript in the root package's __init__.py, where your settings.py lives. After that you can run tests with ./mange.py test -s
|
|||
|
|
|
Solution with command-line only: 1/ install
2/ run tests with time recording (times are saved in file
3/ display tests names sorted by decreasing time:
|
|||||
|