idea 基于junit测试和自动生成测试类
2016-09-18 00:00
549 查看
①之前一直用myeclipse开发,习惯了junit测试。现在用idea开发,不能够测试,太不方便了,发现用@Test识别不了。于是查了poem.xml,发现我的mven里面的jar包版本不对。
junit3 基于 继承TextCase
junit 4 集成了@Text注释
所以直接引入jar 包,版本改为4.10即可。
jar包下载地址:
http://download.csdn.net/download/gongweijiao/3783442
idea 可以引入 JunitGenerator插件 自动生成测试代码
②引入方式:
preference--->Plugins--->搜索框搜索JunitGenerator--->右键upload--->restart
即可
③测试
找到类以后
command+n ---->junit text --->junit4 即可
测试结果(自动生成)
<dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency>
junit3 基于 继承TextCase
junit 4 集成了@Text注释
所以直接引入jar 包,版本改为4.10即可。
jar包下载地址:
http://download.csdn.net/download/gongweijiao/3783442
<dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.10</version> <scope>test</scope> </dependency>
idea 可以引入 JunitGenerator插件 自动生成测试代码
②引入方式:
preference--->Plugins--->搜索框搜索JunitGenerator--->右键upload--->restart
即可
③测试
找到类以后
command+n ---->junit text --->junit4 即可
测试结果(自动生成)
public class CoachDaoImplTest { @Before public void before() throws Exception { } @After public void after() throws Exception { } /** * * Method: saveCoach(CoachInfo coachInfo) * */ @Test public void testSaveCoach() throws Exception { //TODO: Test goes here... } /** * * Method: queryTrain(String level, String coachName, String siteProvince, Date start, Date end, String certNumber, String orderName, Integer orderBy, Integer page, Integer rows) * */ @Test public void testQueryTrain() throws Exception { //TODO: Test goes here... } }
相关文章推荐
- idea自动生成junit测试代码配置
- idea自动生成junit测试代码配置
- IDEA 整合Junit实现自动生成测试代码
- idea 自动生成测试代码junit设置到maven标准测试目录
- [memo]intelij idea 自动生成测试代码junit设置到maven标准测试目录
- IDEA 自动生成Junit进行单元测试
- android-junit-report工具实现android下junit框架测试自动生成报告
- IDEA如何自动生成testNG的测试报告?
- 基于粒子群算法的软件测试用例自动生成算法
- 怎样在IDEA中使用JUnit4和JUnitGenerator V2.0自动生成测试模块
- ant+junit 自动生成测试报告
- 【转载】基于 JUnit 的 InstallAnywhere 安装程序图形界面自动测试框架
- 基于wsdl的测试数据自动生成技术
- IDEA 安装 junit 测 b7da 试插件,生成测试方法
- junit自动生成测试方法
- 怎样在IDEA中使用JUnit4和JUnitGenerator V2.0自动生成测试模块
- 怎样在IDEA中使用JUnit4和JUnitGenerator V2.0自动生成测试模块
- 自动生成基于pyunit的接口测试用例示例
- JPA学习笔记---JPA实体Bean的建立+配置文件+junit测试+自动生成(对应实体Bean的)数据库表+插入数据
- IDEA 配置JUnit 并自动生成Test文件夹和类