下一步是编辑触发测试吗?
我刚刚读了 Michael C. Feathers 的好书有效地处理遗留代码,向遗留代码引入测试的圣经。 在这本书中,他描述了一种称为编辑触发的测试的东西:
如果本书发布时它还没有发布,我怀疑很快就会有人开发出一个 IDE,允许您指定一组在每次击键时运行的测试。 这将是一种令人难以置信的关闭反馈循环的方式。
这必须发生。 这似乎是不可避免的。 已经有 IDE 可以检查每次击键的语法并在出现错误时更改代码的颜色。 下一步是编辑触发测试。
当我读到这篇文章时,我还没有听说过任何支持此功能的 IDE 或工具。 然而,我刚刚发现一个名为 Infinitest 的项目支持 Java。
我的问题是:
- 是否有其他工具/框架支持此功能(希望也适用于 Visual Studio)?
- 您对此类测试有何体验(高效、降低 IDE 速度等)?
- 这是 TDD 的下一步吗?
更新:
- 看看这个截屏视频,观看 Infinitest 在 Eclipse 中的实际应用。
- 刚刚找到一个博客,其中 Brett Schuchert 分享了一些 Infinitest 体验。
I have just read Michael C. Feathers great book Working Effectively with Legacy Code, the bible of introducing tests to legacy code. In this book he describes something called Edit-triggered testing:
If it isn't out by the time this book is released, I suspect that someone will soon develop an IDE that allows you to specify a set of tests that will run at every keystroke. It would be an incredible way of closing the feedback loop.
It has to happen. It just seems inevitable. There are already IDEs that check syntax on each keystroke and change the color of code when there are erros. Edit-triggered testing is the next step.
When I read this I hadn't heard about any IDEs or tools that support this. However, I just found a project called Infinitest that supports this for Java.
My questions are:
- Are there any other tools/framework that support this (hopefully also for Visual Studio)?
- What are your experiences with this kind of testing (efficient, slows down the IDE, etc)?
- Is this the next step of TDD?
Updates:
- Take a look a look at this screencast to see Infinitest in action for Eclipse.
- Just found a blog where Brett Schuchert shares some experiences with Infinitest.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
ruby 有自动测试。 它在您编辑文件时连续运行单元测试,使用一些简单的约定将源文件映射到测试文件。 我还见过一个插件,可以在 emacs 中交互地将测试代码着色为红色或绿色。 我认为在代码编辑器本身中通过/失败的即时视觉反馈的想法很棒。
There's Autotest for ruby. It continuously runs unit tests as you edit files, using some simple conventions to map source files to test files. There's also a plugin for it I've seen that colors the test code red or green in emacs interactively. I think this idea of immediate visual feedback of passing/failing in the code editor itself is great.
自最初的问题提出以来已经有几年了,并且有一些可用于 .NET 的工具(我认为其他语言的这个空间也有所增长)。
有一个 .NET 版本的自动测试(在本线程前面提到过),称为 AutoTest.NET,已分叉并更新为功能更齐全的工具,名为 连续测试。 我大约一年前尝试过,当时它看起来有很大的潜力,但不幸的是,听起来他们已经决定停止开发。 不过,从好的方面来看,它现在免费 !
我没有使用过 NCrunch,但它是一个似乎正在积极开发的商业产品。
还有基于脚本的工具也可能符合您所询问的内容
另请参阅此问题:
如何在 .NET 中进行持续测试?
It's been a few years since the original question, and there are a few tools available for .NET (I assume that this space has grown for other languages as well).
There is a .NET version of Autotest (mentioned previously in this thread) called AutoTest.NET, which has been forked and updated into a more fully-featured tool called ContinuousTests. I tried it about a year ago, and it looked to have a lot of potential at that point, but unfortunately, it sounds like they've decided to stop development. On the up-side, however, it's now free!
I haven't used NCrunch, but it's a commercial product that appears to be actively developed.
There are script-based tools that might also fit the bill for what you're asking about
See also this question:
How do I do continuous testing in .NET?
嗯,它本质上是测试驱动的开发,当您键入时,测试会持续运行? 所以我不会说“编辑触发测试”是一种新的开发技术,而只是 IDE 的一个功能。
关于此功能的速度,我想这实际上取决于您的项目的复杂程度、您使用的编译器和语言以及您所做的更改。 如果您正在修改整个项目中使用的某些基础库,则编译器将必须重新编译程序的很大一部分,以便能够使用您的代码在其他库中运行测试。
Well, it essentially is Test-driven development, with tests being run continuously, as you type? So I wouldn't say "edit-triggered testing" is a new development technique, but merely a feature of your IDE.
Regarding the speed of this feature, I guess it really depends on how complex your project is, what compiler and language you are using, and what changes you are making. If you are modifying some base library which is used throughout the project, your compiler will have to recompile a large part of your program to be able to run tests in other libraries using your code.