llc2005
级别: 测试新手
精华:
0
发帖: 32
基地声望: 13 点
基地币: 6665 Bug
基地贡献: 0 点
好评度: 0 点
在线时间:12(小时)
注册时间:2005-11-28
最后登录:2006-02-09
|
[求助]strutstestcase自动生成的测试Action的代码
strutstestcase自动生成的代码如下:
package com.alyssa.actions;
import servletunit.struts.*; import java.sql.*; import org.apache.struts.action.*; import javax.servlet.http.*;
public class TestarticleAction1 extends MockStrutsTestCase { private articleAction articleAction = null;
protected void setUp() throws Exception { super.setUp(); articleAction = new articleAction(); }
protected void tearDown() throws Exception { articleAction = null; super.tearDown(); }
public void testAdd() throws SQLException { ActionMapping actionMapping = null; ActionForm actionForm = null; HttpServletRequest servletRequest = null; HttpServletResponse servletResponse = null; ActionForward expectedReturn = null; ActionForward actualReturn = articleAction.add(actionMapping, actionForm, servletRequest, servletResponse); assertEquals("return value", expectedReturn, actualReturn); /**@todo fill in the test code*/ }
}
问题是:MockStrutsTestCase这个类有很多辅助测试的方法,而它自动生成的却是和JUnit的没什么区别,也是去调用add(xx,xx,xx,xx)这个方法来进行测试,而actionMapping ,actionForm,servletRequest, servletResponse等的付值该怎么付呢?? 它是自动生成付的全是null,但要达到测试目的就不可以是null,我该怎么写呢? 请前辈指教
又或是它自动生成的一些测试方法是根本无用的,应该全部自己重新写过?
|
|
|
|
[楼 主]
|
Posted: 2005-12-29 09:34 |
| |