English 中文(简体)
我如何在春季多国师论坛框架内使用手伯,测试@ResponseBody控制器的行动?
原标题:How do I use HandlerAdapter in the Spring MVC framework to test @ResponseBody controller actions?

目前正在使用普林茨克星号HandlerAdapter,测试我春天控制器行动的说明,以确保道路变数、要求参数、会议属性、@Valid等得到正确表述。

I ve come across a problem where if a controller action has @ResponseBody and doesn t return a ModelAndView, I cannot test the response using the HandlerAdapter.

I found a question on this site that is related, but the accepted answer given is not satisfactory:

如何对春天主计长发出的应变或反应性进行单位测试?

我如何同时测试说明和结果? 或者,我是否需要写两个测试——一个测试说明,另一个是直接使用控制器方法?

增 编

问题回答

如果有<代码>@ResponseBody。 然后,笔记员将一张<代码>ModelAndView退回,然后用电文函直接写给答复。

一种做法是拦截反应,而不是读取回的价值。





相关问题
Selenium not working with Firefox 3.x on linux

I am using selenium-server , selenium rc for UI testing in my application . My dev box is Windows with FireFox 3.5 and every thing is running fine and cool. But when i try to run selenium tests on my ...

Best browser for testing under Safari Mobile on Linux?

I have an iPhone web app I m producing on a Linux machine. What s the best browser I can use to most closely mimic the feature-limited version of Safari present on the iPhone? (It s a "slimmed down" ...

Code Coverage Tools & Visual Studio 2008 Pro

Just wondering what people are using for code coverage tools when using MS Visual Studio 2008 Pro. We are using the built-in MS test project and unit testing tool (the one that come pre-installed ...

Is there any error checking web app cralwers out there?

Wondering if there was some sort of crawler we could use to test and re-test everything when changes are made to the web app so we know some new change didn t error out any existing pages. Or maybe a ...

热门标签