Servlet单元测试 [英] Servlet unit test

查看:113
本文介绍了Servlet单元测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我正在使用TestNG框架来测试应用程序业务逻辑,最近我添加了一些Servlet类。

Currently I'm using TestNG framework for testing application business logic, i added some Servlet classes recently.

如何在TestNg框架中对这些Servlet类进行单元测试?

How do I unit test these Servlet classes in TestNg framework?

推荐答案

如果可能,请遵循skaffman的建议。如果没有,或者如果你想测试servlet作为前端控制器的行为,而不是它们内部的业务逻辑,你可以使用:

Follow skaffman's advice if possible. If not, or if you want to test the behaviour of the servlets as front-end controllers, rather than the business logic inside them, you can use:

  • HtmlUnit
  • Selenium
  • Cactus (but I don't know how whether it supports TestNG already)

这篇关于Servlet单元测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆