简体   繁体   English

测试复合图案

[英]Testing the Composite Pattern

Do you know well-tested and open source Composite examples in Smalltalk? 您是否知道Smalltalk中经过测试和开放源代码的Composite示例?

I would like to review example implementations of the Composite pattern in Smalltalk. 我想回顾Smalltalk中Composite模式的示例实现。 Any dialect is fine, I am interested particularly in source code including unit test cases. 任何方言都可以,我对包括单元测试用例的源代码特别感兴趣。 This post describes what I am looking for, common testing snippets which can be re-used in my applications. 这篇文章描述了我正在寻找的,可以在我的应用程序中重复使用的常见测试代码段。

An well-designed implementation is useful too because I want to learn how composite tests are structured. 设计良好的实现也很有用,因为我想学习组合测试的结构。

The composite pattern is extremely common in Smalltalk, I suspect almost any reasonably sized application has one or more uses of this design pattern. 复合模式在Smalltalk中非常常见,我怀疑几乎任何大小合适的应用程序都对此设计模式有一个或多个用途。 Some of the packages I know that contain a lot of tests include: 我知道一些包含很多测试的软件包包括:

  • Refactoring engine: The refactoring engine contains dozens of composites, most prominent the model of the AST. 重构引擎:重构引擎包含数十种复合材料,其中最突出的是AST模型。 It comes with a good collection of tests and is available in almost all Smalltalk dialects. 它带有大量测试,并且几乎在所有Smalltalk方言中都可用。

  • Seaside: This web application framework models request handlers, widgets, html tags, configurations, ... as composite objects. Seaside:此Web应用程序框架将请求处理程序,小部件,html标记,配置等作为复合对象进行建模。 Again, it comes with a good collection of tests and is available on many Smalltalk platforms. 同样,它附带了大量的测试,并且可以在许多Smalltalk平台上使用。

  • Pier: This content management system has various composites to model nested pages and their content. Pier:此内容管理系统具有各种组合,可以为嵌套页面及其内容建模。 There are hundreds of tests that validate the construction, destruction and behaviour of these composite structures. 有数百项测试可验证这些复合结构的构造,破坏和行为。 The tests are structured across the hierarchy of the classes and many tests are reused on different kind of nodes. 测试跨类的层次结构进行构造,许多测试在不同种类的节点上重复使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM