移除“集成测试骗局". -了解协作和合同测试 [英] Removing the "integration test scam" - Understanding collaboration and contract tests

查看:173
本文介绍了移除“集成测试骗局". -了解协作和合同测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近看过JB Rainsberger和他的集成测试是一个骗局.现在正在寻找有关该主题的更多材料.我不得不说,我为我们做错了多少而感到震惊(即应该进行单元测试的集成测试),Rainsberger所描述的概念对此很感兴趣,但也对如何应用它们感到困惑.我想要更多描述的协作测试和合同测试,但我不知道从哪里开始.

I've recently watched Integration Tests are a Scam by J. B. Rainsberger and am now looking for more material on the subject. I have to say, I'm shocked by how much we're doing wrong, (i.e. integration testing when we should unit test), intrigued by the concepts described by Rainsberger but also confused about how to apply them. I would like to have more of the described collaboration tests and contract tests but I don't know where to start.

我唯一想到的就是测试需要问的四个问题:

The only things that got stuck in my mind are the 4 questions the tests need to ask:

A面:

Do I ask the right question?
Can I deal with the answer?

B面:

Can I answer a question?
Do I answer correctly?

但是如何将其应用于应用程序堆栈中的某些随机方法?

But how do I apply this to some random method in my application stack?

有没有一本书,一个教程或一个实例可以作为现实世界的例子,并应用这些孤立的微型测试的思想? 理想情况下,该示例使用Java,C#或C ++.

Is there a book or a tutorial or example out there that takes a real world example and applies these ideas of isolated micro tests? Ideally the example uses Java, C# or C++.

凡是涉及这些概念并能帮助我更好地理解它们的文献,将不胜感激.

Any literature that deals with these concepts in general and helps me understand them better would be appreciated.

如果那里有论坛,我可以问更详细的问题,以了解如何正确进行单元测试,甚至重构现有代码并发布示例也将很不错.

Also if there are forums out there where I can ask more detailed questions about how to go about correctly unit testing and maybe even refactoring existing code and post examples would be nice.

谢谢!

推荐答案

我建议 xUnitTestPatterns-重构测试代码(由Gerald Meszaros编写)可以在单个方法级别进行测试时提供对您的问题的一些见解以及各种实践的优缺点的详细信息.

I would recommend xUnitTestPatterns - Refactoring Test Code by Gerald Meszaros which provides some insights into your questions and a lot of detail on good and bad of various practices when testing at the individual method level.

如果您阅读了Fowler的Refactoring,您会发现问题的答案不一定是黑白的,而是基于您和其他人的经验启发法.

If you have read Refactoring by Fowler, you'll see that the answer to your questions is not necessarily black and white, but based on heuristics from your and others experience.

这篇关于移除“集成测试骗局". -了解协作和合同测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆