Python 单元测试有可视化工具吗?

发布于 2024-08-21 02:00:44 字数 363 浏览 13 评论 0原文

我正在编写相当多的单元测试,并使用 nosetests 来运行它们。 Nose 确实让运行测试变得更好、更容易,但在最好的情况下,输出可能会非常混乱,而在其他情况下,输出可能会完全混乱,具体取决于警告和错误。

我想知道是否有任何视觉工具可以包裹鼻子,以便反馈更干净。显示测试名称、运行时间并用颜色指示成功/失败状态的结果网格将是一个巨大的视觉帮助。更好的是,如果它可以根据具体情况拆分错误消息和回溯,那么当大量测试因重大更改而失败时,它确实会减少混乱的数量。

这听起来像是一个愿望清单,但是是否有任何接近此的东西存在呢?

I'm writing quite a few unit tests and using nosetests to run them. Nose certainly makes it nice and easy to run tests, but the output can be pretty cluttered at the best of times, and a downright mess at others, depending on warnings and errors.

I was wondering if there are any visual tools that wrap nose so that the feedback cleaner. A results grid showing test names, run times and indicating success/failure status with colours would be a huge visual aide. Better still, if it could split up the error messages and tracebacks on a case by case basis, it would really cut down on the amount of clutter when a large number of tests fail on a major change.

This is starting to read like a wishlist, but does anything even close to this exist?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

当爱已成负担 2024-08-28 02:00:44

这里有一个非常类似的问题

看起来并没有一个用于鼻子测试的标准化 GUI(例如,仅针对 python 接口进行标准化)。似乎有一些用于鼻子测试的 GUI 插件,具体取决于您使用的 IDE - 快速搜索会出现

然而,还有许多其他基于 GUI 的 Python 单元测试框架 - 您尝试过 PyUnit 吗?

There's a very similar question here.

It doesn't look like there's a standardized GUI for nosetests (as in, standardized for just the python interface). There seems to be a few GUI plugins for nosetests depending on which IDE you're using - a quick search brought up this link for Komodo.

However, there are many other GUI based unit testing frameworks out there for Python - have you tried PyUnit?

眼藏柔 2024-08-28 02:00:44

好吧,你可以做的是使用 jenkins 集成服务器,我们使用它与 py.test 和 phpunit 一起使用(将其与任何其他测试框架一起使用非常简单),它为我们提供了一些奇特(且有用!)的图表,其中包含

  • 运行的测试数量、
  • 通过/失败的测试数量、
  • 失败的堆栈跟踪测试 测试
  • 的执行时间
  • 测试的代码覆盖率
  • 您还可以将其与 git/svn/mercurial...

这里 你有一个如何配置 hudson 的示例(郑重声明,jenkins 是 hudson 的一个分支,所以说明是仍然有效:),以便提供您的愿望清单中的元素。

一个更简单的选择是使用 PyCharm 等 IDE,它与鼻子测试集成,并会告诉您哪些测试通过/失败及其时间,但是,jenkis 存储历史数据。

祝你好运 :)

Well, what you can do is to use the jenkins integration server, we use it with py.test and phpunit (it is really simple to use it with any other testing framework), it provides us some fancy (and useful!) graphs containing

  • Number of tests that run
  • Number of tests passing/failing
  • The stack trace for the failed tests
  • Execution times for tests
  • Code coverage for the tests
  • You can also relate it to git/svn/mercurial...

Here you have an example of how to configure hudson (for the record, jenkins is a fork of hudson, so the instructions are still valid :), in order to provide the elements from your wishlist.

An easier option is to use a IDE as PyCharm, it has integration with nosetests, and will tell you which tests passed/failed and its times, however, jenkis stores historical data.

Good luck :)

情魔剑神 2024-08-28 02:00:44

您是否看过Nose 插件页面?快速浏览一下,至少有几个声称他们可以提供 GUI 界面。

Have you taken a look at the Nose plugins page? A quick glance revealed at least a couple that stated they could provide a GUI interface.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文