如何为更复杂的方法实施单元/集成测试 [英] How do I implement unit/intergration testing for more complex methods

查看:88
本文介绍了如何为更复杂的方法实施单元/集成测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨大家



我有一个评级引擎已经实施到我们的项目中,在我们决定在我们的解决方案中实施单元测试之前,引擎已经建成。 />


基本上我们的棘轮引擎算法是如何工作的,我们将id值传递给它,引擎中有一些方法可以加载客户端数据,然后根据在UI级别捕获的几种真/假年龄等方法。



我想有一些链接或一些指导正确的方向是什么样的测试将被实施



我尝试过:



我当测试运行

Hi Guys

I have a rating engine which was implemented into our project, before we decided to implement unit testing into our solution the engine was built.

So basically how our ratting engine algorithm works is we pass an id value to it, there are methods in the engine which will load the client data and then rating gets calculated based on a couple methods of true/false age etc which is captured at UI level.

I would like to have a some links or some guidance into the correct direction of what kind of testing would be implemented

What I have tried:

I have looked into Nunit as well as Moq framework to present moq data, when the tests runs

推荐答案

时,我们会调查Nunit以及Moq框架来呈现moq数据。还要为代码中使用的类取出一些接口并传递作为构造函数的一部分的具体实现 - 这样你可以用mock cl替换它们在您的单元测试中评估,以隔离您正在测试的代码位。
Also tease out some interfaces for the classes used in your code and pass the concrete implementations in as part of the constructors - that way you can replace these with mock classes in your unit tests to isolate the bit of the code you are testing.


这篇关于如何为更复杂的方法实施单元/集成测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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