java web 测试

现在做java web开发,想边编代码边写测试代码,但是不怎么会写。

请问有什么这方面的资料或者书籍吗?最好是书籍。

推荐一本书junit in action 或者 你直接上junit官网学习也是不错的选择。

你既然是开发的,junit是你最好的选择。其他事情是测试那边做得

写junit单元测试吧!一般你也只能测试service 和 dao. 一般来说测试这2个也够了. 给你看下例子.

public class JdbcTest extends DaoTestCase {

// ServiceComputer
ServiceComputer serviceComputer;
public void setServiceComputer(ServiceComputer serviceComputer) {
    this.serviceComputer = serviceComputer;
}

public void testExecuteSearch()throws Exception {
    Computer computer = serviceComputer.get("1111:);
       System.out.println(computer );


    }

}

}

junit东西不多,很容易。