测试数据密集型遗留应用程序的技巧
我正在开发一个非常大的数据密集型遗留应用程序。 代码库和 数据库规模庞大。 大量业务逻辑分布在所有层中,包括存储过程中。
有没有人对如何开始以有效的方式将“单元”测试(技术上的集成测试,因为他们需要针对几乎任何给定流程的单个方面进行跨层测试)应用到应用程序有任何建议? 当前的架构不容易支持任何类型的注入或模拟。 正在编写新代码以方便测试,但是遗留代码呢? 由于对数据本身和数据库中的业务逻辑的强烈依赖,我目前使用内联sql来查找用于测试的数据,但这些非常耗时。 创建视图和/或存储过程是不够的。
您采取了哪些方法(如果适用)? 什么有效? 什么没有& 为什么? 任何建议,将不胜感激。 谢谢。
I'm working on a very large, data-intensive legacy application. Both the code base & database are massive in scale. A great deal of the business logic is spread across all of the tiers including in stored procedures.
Does anybody have any suggestions on how to begin applying "unit" tests (technically integration tests because they need to test across tiers for a single aspect of almost any given process) into the application in an efficient way? The current architecture does not easily support any type of injection or mocking. New code is being written to facilitate testing, but what about the legacy code? Because of the strong dependency on the data itself and business logic in the database, I'm currently using inline sql to find data to use for testing but these are time consuming. Creating views and/or stored procedures will not suffice.
What approaches have you taken (if applicable)? What worked? What didn't & why? Any suggestions would be appreciated. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
获取有效使用旧代码的副本作者:迈克尔·费瑟斯。 它充满了使用大型、未经测试的代码库的有用建议。
另一本好书是面向对象的重新设计模式。 本书的大部分内容并不专门针对面向对象软件。 全文可免费下载 PDF 格式。
根据我自己的经验:尝试...
要避免的事情:
Get a copy of Working Effectively with Legacy Code by Michael Feathers. It is full of useful advice for working with large, untested codebases.
Another good book is Object Oriented Reengineering Patterns. Most of the book is not specific to object-oriented software. The full text is available for free download in PDF format.
From my own experience: try to...
Things to avoid:
“测试遗留应用程序现代化”重点介绍:
如何在 AscentialTest 中创建测试的高级概述
将遗留对象转换为新平台组件的方法对象定义的
如何确保应用程序的现代化版本产生相同的结果
有关测试遗留应用程序的使用的更多详细信息,请在此处检查:
http://application-management.cioreview.com/whitepaper/testing-legacy-application-modernization-wid-529.html
“Testing Legacy Application Modernization,” highlights:
High level overview of how tests are created in AscentialTest
Ways to convert the legacy objects to the new platform Components of Object definition
How to ensure that the modernized version of the application produces the same results
For more details on usage of testing legacy application, do check here:
http://application-management.cioreview.com/whitepaper/testing-legacy-application-modernization-wid-529.html
如前所述,有一些非常好的书籍。 强烈建议您查看有效使用遗留代码。
您可以做的就是遵循数据驱动的方法,观察您的应用程序并在您有更多“痛苦”的地方引入测试。 您可能会发现有用的半确定性方法:https://link.medium.com/zY9Tysfne9
As mentioned before, there are some very good books out there. Highly recommended to take a look at Working Effectively with Legacy Code.
Something you could do is following a data driven approach, observe your application and introduce tests where you have more “pain”. A semi-deterministic approach you might find useful: https://link.medium.com/zY9Tysfne9