1. idea中的maven項目如果想進行junit進行單元測試,可以在pom中使用依賴,
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>RELEASE</version>
</dependency>
2. idea中普通項目想要進行單元測試,可以參考如下文章,首先要下載安裝一個junitGenerator插件,然后在配置文件中配置一下test所在的目錄。或者下載兩個jar包,創建lib文件夾存放,並且導入到項目中去。
http://www.cnblogs.com/huaxingtianxia/p/5563111.html ,下載插件進行單元測試,需要配置自己的test目錄。
http://www.jianshu.com/p/7088822e21a3,下載並且導入jar包,進行單元測試,ctrl + shift + t 可以選擇類中要測試的方法,自動生成測試方法。