集成测试执行 [英] Integration tests implementation

查看:223
本文介绍了集成测试执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个三层的应用程序

I have a three tiered app


  • Web应用程序(asp.net mvc的为简单起见这里),

  • 商务服务

  • 数据存储库

和我知道有四种类型的集成测试:

And I know there are four types of integration tests:


  • 自上而下

  • 自下而上

  • 三明治(前两名的组合)

  • 大爆炸

我知道,我会写大爆炸测试就像单元测试,但没有任何嘲笑,所以我会使用一个后台数据库,以及...

I know I would write big-bang tests just like unit tests but without any mocking so I would employ a backend DB as well...

我不知道该怎么写其它类型的集成测试?

I don't know how to write other types of integration tests?


  1. 怎么我写的非BIGBANG类型的集成测试呢?

  2. 应该集成测试等于单元测试,这意味着同样数量的测试,但没有嘲笑测试?还是应该这些试验测试完全不同的东西?

任何人可以提供的任何信息如何做到这一点(如果有的话),还是它实际上是可行干什么呢?

Could anybody provide any information how to do this (if at all) or whether it's actually feasible doing it?

推荐答案

我建议做这些:


  1. 单元测试/不能打任何外部资源

  2. 集中集成测试(我想这会是自下而上)。你应该有code,这是非常接近的外部资源,它的唯一责任是与它集成。不要试图单元测试这些类,而不是做击中了真正的资源,不具备处理的逻辑系统中的其余部分非常注重测试。保持这个集成类尽可能薄

  3. 全系统测试(我猜大爆炸)。我的意思是与UI和一切(或API,如果这是你的终点)。确保你覆盖尽可能用previous测试,这更像是简单的检查标的件适当地吸引住了。

根据您的系统,你可能还是不希望在code的顶层与集成测试,以配合3,但不涉及用户界面。不管你采取哪个选项,确保通过单元放有多个COM prehensive覆盖;集中整合测试,在最高级别测试各种行为都有复杂程度,可以让失控的速度非常快。

Depending on your system, you may or not want to complement 3 with integration tests at the top level of the code, but without involving the UI. Regardless of which option you take, make sure to have more comprehensive coverage through unit & focused integration tests, as testing various behavior at the top level have a complexity level that can get out of control very quickly.

应该集成测试等于单元测试,这意味着同样数量的测试,但没有嘲笑测试?还是应该这些试验测试完全不同的东西?

Should integration tests be equal to unit tests meaning same number of tests, but testing without mocks? Or should these tests test something completely different?

我在1安培提及; 2,最好当那些测试不同的事情。这取决于系统,但我通常会期望的单元测试量要集成测试了几倍。对于全系统测试,确保你有足够的,这样你可以告诉所有的作品被正确大呼过瘾,但没有这么多,它变得太复杂,测试场景。

As I mentioned in 1 & 2, its best when those test different things. This depends on the system, but I'd usually expect the amount of unit tests to be a few times the amount of integration tests. For full system tests, make sure you have enough so that you can tell all the pieces were hooked correctly, but not so much that it becomes too complex to test each scenario.

这篇关于集成测试执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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