单元测试 覆盖率问题
下载nutz源码
选择src-main-java 下的第一个文件夹邮件,点击run tests in " "with coverage,
查看覆盖率 :比如NutMapTest 实际覆盖率 还是有的 为什么显示覆盖率是0% idea里面看的 这个是为什么
2 回复
想写一个测试类 WhaleFilter 不知道 该如何写
public abstract class WhaleFilterTest {
protected Servlet servlet;
protected MockHttpServletRequest request;
protected MockHttpServletResponse response;
protected MockHttpSession session;
protected MockServletContext servletContext;
protected MockServletConfig servletConfig;
protected abstract void initServletConfig();
protected void newreq() {
request = Mock.servlet.request().setSession(session);
request.setContextPath("");
request.setSession(session);
response = new MockHttpServletResponse();
}
@Before
public void init() throws Throwable {
servletContext = Mock.servlet.context();
servletConfig = new MockServletConfig(servletContext, "nutz");
initServletConfig();
servlet = new NutServlet();
servlet.init(servletConfig);
session = Mock.servlet.session(servletContext);
newreq();
}
@Test
public void me() {
}
添加回复
请先登陆