从真实执行创建模拟的工具
我正在研究这个,我们称之为遗留代码,使用接口(IFjuk)调用另一个组件。
我意识到模拟通常用于单元测试,但我认为它对于某种形式的“系统测试”可能有用。我的主要目标是摆脱对外部硬件的依赖。
执行过程会多次调用 IFjuk,这会使手动编写和维护定义模拟期望的代码变得很麻烦。
我的一个想法是使用 Castle Dynamic Proxy 来记录调用(包括来自真实组件的返回值)并从定义 RhinoMock 模拟的代码生成 C# 代码,但我怀疑肯定有人已经构建了类似的东西...
有没有一种工具可以记录对实际组件的 IFjuk 调用和响应,以便我可以使用该数据生成模拟?
I'm working on this ,let's call it legacy, code that makes calls to another component using an interface (IFjuk).
I realize that mocking is generally intended for unit testing, but I thought it might be useful for a form of "system test". My primary goal is to get rid of a dependency on a piece of external hardware.
The execution makes many calls to IFjuk, which would make it cumbersome to manually write and maintain code that defines the mock expectations.
One idea I have is to use Castle Dynamic Proxy to record calls (including return values from the real component) and generate C# code from that which defines RhinoMock mocks, but I suspect someone must have built something similar already...
Is there a tool that can record calls and responses to IFjuk against the actual component, so that I can use that data to generate mocks?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,没有任何内置的“调用跟踪器”可用,但我认为这是 AOP http://www.c-sharpcorner.com/uploadfile/shivprasadk/aspect-orient-programming-in-C-Sharp-net-part-i/ 可能变得非常有用。
No there is no any builtin "call tracer" available, but I think this is one of the place where AOP http://www.c-sharpcorner.com/uploadfile/shivprasadk/aspect-oriented-programming-in-C-Sharp-net-part-i/ can become very useful.