系统测试集成测试单元测试_关于集成测试

系统测试集成测试单元测试

Previously] I was talking about combinatorial complexity of integration tests in multicomponent systems, so let me remind. Let's build a simple system with only 3 components inside. It can be three independent modules and we want to provide some communication between them (message passing good enough for the purpose of the example) So we have 3! = 6 possible configuration to test. Before going deeper lets see how Quicksort fights a combinatorial complexity. 以前 ]我在谈论多组件系统中集成测试的组合复杂性,所以让我提醒一下。 让我们构建一个仅包含3个组件的简单系统。 它可以是三个独立的模块,我们希望在它们之间提供一些通信(对于示例而言,消息传递得足够好),所以我们有3个模块! = 6种可能的配置进行测试。 在深入探讨之前,让我们先看看Quicksort如何克服组合的复杂性。

[Quicksort] reduces complexity on each pass of a given input. So far so good. Let's imagine example with 10 elements. How many possible permutations do we have? you are right: 10! ~= 3,6 * 10^6. So on the first pass the complexity will be reduced: 5!*5!, on the next pass it will be further reduced till 2!*3!*2!*3!… after logn times we will have 1!*1!*1!...1! = 1 possible position, and our given input is sorted. Gotcha. (attentive reader can mention about worst case scenario of quicksort, but lets discuss it someday) Coming back to our example…

[Quicksort]降低了给定输入每次通过的复杂度。 到目前为止,一切都很好。 让我们想象一下包含10个元素的示例。 我们有多少种可能的排列? 你是对的:10! 〜= 3,6 * 10 ^ 6。 因此,第一遍的复杂度将降低:5!* 5 !,下一遍的复杂度将进一步降低至2!* 3!* 2!* 3!…登录时间后,我们将得到1!* 1!。 * 1!... 1! = 1个可能的位置,并且我们给定的输入进行了排序。 知道了 (细心的读者可以提及Quicksort的最坏情况,但是有一天可以讨论一下)回到我们的例子中……

[Simple task] So we have a task to pass a message through our entire system, our three modules system. Let us not reinvent the wheel and call our modules A,B,C. Just keep in mind 3! possible configurations, we need to build a system with only one allowed configuration: A -> B -> C. Easy. Lets add a feature and allow module C to send a message to module A — we are getting two more configurations: B->C->A, C->A->B (some people can recall terms permutations, combinations) In practice we get circle structure, which is very useful to be honest, and first structure called linked-list. If we continue to play around and allow modules to send message back we end up with bidirectional linked-list. We will discuss structures a bit later, lets come back to our three modules system and add one more module B2.

[简单的任务]因此,我们有一个任务要通过整个系统(三个模块的系统)传递消息。 让我们不要重新发明轮子,而是将我们的模块称为A,B,C。 请记住3! 可能的配置,我们只需要构建一个只有一个允许的配置的系统:A-> B->C。 让我们添加一个功能并允许模块C向模块A发送消息-我们将获得另外两种配置:B-> C-> A,C-> A-> B(有些人可以回忆起术语排列,组合)我们得到圆形结构,说实话,这非常有用,第一个结构称为链表。 如果我们继续玩耍并允许模块发送回消息,那么我们将获得双向链表。 稍后我们将讨论结构,让我们回到我们的三个模块系统,再添加一个模块B2。

[Nature of a bug] So we have a system with four modules: A,B,B2,C. As you can see B and B2 are almost the same. So we have 4! possible configurations and the task to send a circular message. The same guy can easily add one module to the system and to conclude that there is only 4 possible configurations, because previously there were 3 and he or she added only one more module. Almost. The truth is that we have 4 more configurations (B and B2 can be swapped), in total 8. Programmer covered four, other four paths are left in a wild. Should we blame him or her? who knows, lets better look on tools which developer use to fight with complexity.

[错误的性质]因此,我们有一个包含四个模块的系统:A,B,B2,C。 如您所见,B和B2几乎相同。 所以我们有4个! 可能的配置和发送循环消息的任务。 同一个人可以轻松地向系统中添加一个模块,并得出结论,只有4种可能的配置,因为以前只有3种,并且他或她仅添加了一个模块。 几乎。 事实是,我们总共还有8种配置(B和B2可以互换),程序员涵盖了4种,而其他4种路径则空无一人。 我们应该责怪他还是她? 谁知道,让我们更好地研究开发人员用来应对复杂性的工具。

[Tools] They are: if statement and feels like a god == to use unconstrained systems. For many of us just much simpler to build a system without any structure and constraints. Full stop. Don't lie to yourself, we want to feel max flexibility that's why we choose javascript, remember? You can say OK, its all good and maybe true, but what about React? Lets go further…

[工具]它们是:if语句,感觉就像是上帝==来使用不受约束的系统。 对于我们许多人而言,构建一个没有任何结构和约束的系统要简单得多。 句号 不要自欺欺人,我们想感受最大的灵活性,这就是我们选择javascript的原因,还记得吗? 您可以说OK,这一切都很好,也许是真的,但是React呢? 让我们走得更远…

[react] Remember the part where we discussed structures? me too. So when one guy starts to write an integration tests all what he or she has it's a number of components in the system. So to cover all paths in the system, developer needs to cover factorial! configurations of the system! How can we do better? Hint: lets provide a bit more information for the guy who has already written 10! tests. If we could somehow provide a structure to a poor guy, his or her life would be much simpler. We just need to expose a (react tree) structure to the library (jest). Then library by comparing trees structure (old/new) can give you what's changed. Profit. Not very big one, but very promising one. And there is more, not for today but will be more in the next topic.

[React]还记得我们讨论结构的那一部分吗? 我也是。 因此,当一个人开始编写集成测试时,他或她拥有的所有东西就是系统中的许多组件。 因此,要覆盖系统中的所有路径,开发人员需要覆盖阶乘! 系统配置! 我们如何做得更好? 提示:让我们为已经写10的家伙提供更多信息! 测试。 如果我们能以某种方式为穷人提供结构,那么他或她的生活就会简单得多。 我们只需要向库(玩笑)公开一个(React树)结构。 然后,通过比较树木的结构(旧/新),图书馆可以为您提供更改。 利润。 不是很大,但是很有前途。 还有更多,不是今天,但在下一个主题中将会更多。

翻译自: https://habr.com/en/post/498204/

系统测试集成测试单元测试

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值