为Struts的测试辩护!

介绍了StrutsTestCase for JUnit,它是标准JUnit TestCase类的扩展,用于测试基于Struts框架的代码。提供Mock Object和Cactus两种方法运行Struts ActionServlet,可在有无servlet引擎时测试代码,还能测试Action对象、映射等,且有验证方法,便于编写单元测试。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一下摘自JAVA视线论坛上很激烈的一篇帖子 [ http://forum.javaeye.com/viewtopic.php?t=6947&postdays=0&postorder=asc&start=0]

StrutsTestCase for JUnit is an extension of the standard JUnit TestCase class that provides facilities for testing code based on the Struts framework. StrutsTestCase provides both a Mock Object approach and a Cactus approach to actually run the Struts ActionServlet, allowing you to test your Struts code with or without a running servlet engine. Because StrutsTestCase uses the ActionServlet controller to test your code, you can test not only the implementation of your Action objects, but also your mappings, form beans, and forwards declarations. And because StrutsTestCase already provides validation methods, it's quick and easy to write unit test cases.

谁说Struts无法测试的?不过这样的测试有点像在打补丁?不是吗?还是不清晰
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值