雅加达仙人掌替代品?
您好,我们有一个包含大量 bean、JSP 等的项目。迫切需要在我们的环境中执行自动化测试(我们使用 Maven)。现在,我们可以轻松地为数据库项目层、我们实现的各种安全实用程序编写测试。但 JSP 页面仍未经过测试。
我搜索了用于服务器端测试的实用程序,Cactus 似乎是最佳选择。然而,根据他们的变更列表,他们的最后一个版本是 1.8,并且是两年多前发布的!
所以问题是——仙人掌发生了什么,它还在发育还是什么?雅加达仙人掌的最新替代品是什么(如果存在)?
Greetings, we have a project with loads of beans, JSP and etc. There is a desperate need for performing automated tests in our environment (we use Maven). Now, we can easily write tests for database project layer, for various security utilities we implemented. But the JSP pages remain untested.
I searched for utilities for server-side testing and Cactus seems the best option. However, according to their changelist, their last release is 1.8 and it was released more than two years ago!
So the question is - what happened to Cactus, is it still developing or what? And what are the recent alternates for Jakarta Cactus (if any exists)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我在最近的项目中结合使用了 Spring、JUnit 和 HttpClient,并取得了一些成功。
Apache HttpClient 提供了强大而灵活的 API,用于构建 http 请求并将其发送到您的应用程序中。它无法复制 Web 浏览器,例如通过运行客户端脚本,但是如果生成的 http 响应(标头、URI、正文)中有足够的内容,那么您可以使用此信息遍历应用程序内的页面并验证行为。您可以发布表单、遵循重定向、处理 cookie 并向您的应用程序提供输入。
JUnit (junit.org) 驱动测试,使用 HttpClient 调用一系列页面,并且可以与应用程序一起部署,使用 ant/maven 独立运行,或者在 IDE 中单独运行。
Spring (springsource.org) 当然是可选的,因为您可能不会在您的项目中使用它。我发现对应用程序的某些部分进行存根/模拟很有用,这样我就可以通过替换 DAO 返回特定的数据值来隔离特定区域(例如前端控制器)直至业务逻辑。它提供了一个优秀的测试上下文框架和专门的TestRunners很好地连接到 JUnit(或 TestNG,如果您愿意)等测试框架。
I've used a combination of Spring, JUnit and HttpClient with some success in recent projects.
Apache HttpClient provides a powerful and flexible API for constructing and sending http requests into your application. It cannot replicate a web browser, say by running client side scripts, however if there is sufficient content within the resulting http responses (headers, URI, body), then you can use this information to traverse pages within the application and validate the behavior. You can post forms, follow re-directs, process cookies and supply the inputs into your application.
JUnit (junit.org) drives the tests, invoking a series of pages with HttpClient and can be deployed alongside the application, run standalone with ant/maven, or run separately inside your IDE.
Spring (springsource.org) is, of course, optional as you may not be using it for your project. I've found it useful to stub/mock out parts of the application, such that I can isolate specific areas, such as front-end controllers, through to the business logic, by substituting the DAOs to return specific data values. It provides an excellent Test Context Framework and specialized TestRunners that hook in well to testing frameworks like JUnit (or TestNG if you prefer).
Cactus 在 ejb2 时代是一个很好的服务器端测试框架,但它不再受支持。
您可以结合使用模拟测试(细粒度)和容器内测试(粗粒度)策略来完全测试您的应用程序。
模拟测试框架:Mockito、Jmockit、EasyMock 等..
集成测试框架 (Java EE) :Arquillian,Embeddable API 等。
我更喜欢 Mockito 和 Arquillian 进行服务器端测试。
Cactus served as a good server-side testing framework in the ejb2 ages and but it's not supported anymore.
You can use combination of both Mock testing (fine-grained) and In-Container testing (coarse-grained) strategy to test your application completely.
Mock Testing Frameworks : Mockito, Jmockit, EasyMock etc..
Integration Testing Frameworks (Java EE) : Arquillian, Embeddable API, etc..
I prefer Mockito and Arquillian for server-side testing.
Arquillian 怎么样?我还没有使用过它,它甚至还没有稳定的版本,但至少它正在积极开发中。
How about Arquillian? I haven't used it and it doesn't even have a stable version yet, but at least it's in active development.
您可能想尝试硒。我发现 jBehave 是一个很好的组合。对这两个项目的支持越多,它们就越不会消亡(就像仙人掌一样)。
You might want to try selenium. That with jBehave is a good combination I'm finding. And the more support for both those projects, the more they will not go defunct (like cactus).