获取关于Django unittest框架的扩展信息

获取关于Django unittest框架的扩展信息,django,python-unittest,django-unittest,Django,Python Unittest,Django Unittest,我正在使用Django单元测试框架来测试我的应用程序。 当我执行所有的测试用例时,我得到了关于成功运行的测试用例的非常简短的信息 ---------------------------------------------------------------------- Ran 252 tests in 8.221s OK 这是非常少的信息。我想了解更多关于每个测试用例的信息 e、 g 每个测试用例执行所花费的时间 成功完成每个测试模块。 等等 我们是否有任何debugh或任何其他参数可以启

我正在使用Django单元测试框架来测试我的应用程序。 当我执行所有的测试用例时,我得到了关于成功运行的测试用例的非常简短的信息

----------------------------------------------------------------------
Ran 252 tests in 8.221s

OK
这是非常少的信息。我想了解更多关于每个测试用例的信息

e、 g

每个测试用例执行所花费的时间

成功完成每个测试模块。 等等

我们是否有任何debugh或任何其他参数可以启用关于已执行测试用例的扩展信息

注意:-使用verbosity参数不能满足我的需要

如果键入以下内容,则每个django命令都有一个-help选项:

python manage.py test-帮助您将看到命令测试的所有可用选项:

如您所见,您可以通过添加:-v[level]来设置详细级别


例如,尝试使用:python manage.py test-v3

如果您想要每个测试的时间,以及一些额外的信息,请作为一个选项签出。我们希望从测试运行中获得更多信息,所以我们内置了它


请注意,目前仅为Django 1.6+

感谢您的及时回复。但是这个参数对我没有帮助。实际上我已经试过了。它只给出正在执行的testcase的名称和testcase的状态。我主要是想把时间花在每个测试用例上。嗯,也许你可以编写你的定制TestRunner来向日志中添加额外的信息。。。但是知道一次考试要花多少钱真的有用吗?考虑到它们运行得非常快,而且时间并不是代码实现速度的可靠指标。实际上,我们正在为我们的项目进行分布式开发。我认为这可能是一种计算某个函数所用时间的方法。实际上,我已经在visual studio集成测试框架中使用了此功能。。你有什么意见可以启发我吗?
Options:
  -v VERBOSITY, --verbosity=VERBOSITY
                        Verbosity level; 0=minimal output, 1=normal output,
                        2=verbose output, 3=very verbose output
  --settings=SETTINGS   The Python path to a settings module, e.g.
                        "myproject.settings.main". If this isn't provided, the
                        DJANGO_SETTINGS_MODULE environment variable will be
                        used.
  --pythonpath=PYTHONPATH
                        A directory to add to the Python path, e.g.
                        "/home/djangoprojects/myproject".
  --traceback           Raise on exception
  --noinput             Tells Django to NOT prompt the user for input of any
                        kind.
  --failfast            Tells Django to stop running the test suite after
                        first failed test.
  --testrunner=TESTRUNNER
                        Tells Django to use specified test runner class
                        instead of the one specified by the TEST_RUNNER
                        setting.
  --liveserver=LIVESERVER
                        Overrides the default address where the live server
                        (used with LiveServerTestCase) is expected to run
                        from. The default value is localhost:8081.
  -t TOP_LEVEL, --top-level-directory=TOP_LEVEL
                        Top level of project for unittest discovery.
  -p PATTERN, --pattern=PATTERN
                        The test matching pattern. Defaults to test*.py.
  --version             show program's version number and exit
  -h, --help            show this help message and exit