Atitit junit最佳实践 目录 1.1. 可以在包级别建立测试,避免太多的test class 1 1.2. 但文件独立方法测试 避免建立太多的class 1 1.3. 测试方法直接从bat

Atitit junit最佳实践

目录

1.1. 可以在包级别建立测试,避免太多的test class 1

1.2. 但文件独立方法测试 避免建立太多的class 1

1.3. 测试方法直接从bat执行 取代main模式 2

1.4. 可以单独做方法测试  单独执行一个方法,避免main模式 2

1.5. class内执行 2

2. Junit的不足 2

2.1. 必须要void返回?? 2

2.2. Static 模式方法执行 2

2.3. 必须要public?? 2

2.4. 待参数方法执行 2

3. Qa 2

3.1. Ini err 2

4. Main测试的问题 3

4.1. 不能直接在方法上右键run,导致main和方法距离较远,不能一个实现看到 3

4.2. 单独执行多个方法,需要修改多次main 指定切换 3

5. Ref 3

1.1. 可以在包级别建立测试,避免太多的test class

1.2. 但文件独立方法测试 避免建立太多的class

protected static void moveDir2dest(File strFileName, String dest) {

// TODO Auto-generated method stub

}

@Test

protected static void test_moveDir2dest(File strFileName, String dest) {

// TODO Auto-generated method stub

}

1.3. 测试方法直接从bat执行 取代main模式

1.4. 可以单独做方法测试  单独执行一个方法,避免main模式

1.5. class内执行

可以在本class内执行 。。貌似必须void public  并且非static ???

2. Junit的不足

2.1. 必须要void返回 valied

2.2. Static 模式方法执行 valied

2.3. 必须要public??

2.4. 待参数方法执行

3.  Qa

3.1. Ini err

Mubst  no has param

Must not static method

4. Main测试的问题

4.1. 不能直接在方法上右键run,导致main和方法距离较远,不能一个实现看到

4.2. 单独执行多个方法,需要修改多次main 指定切换

5. Ref

Atitit unit test junit useage

Atitit 提升用户体验与开发效率的好工具junit

可以单独做方法测试

JUnit实战_360百科.html

1部分 认识JUnit1JUnit起步第2章 探索JUnit的核心第3章 掌握JUnit4章 软件测试原则 第2部分 不同的测试策略第5章 测试覆盖率与开发第6章 使用stub进行粗粒度测试第7章 使用mock objects进行测试第8章 容器内测试 第3部分 JUnit与构建过程第9章 从Ant中运行JUnit测试第10章 从Maven2中运行JUnit测试第11章 持续集成工具 第4部分 JUnit扩展第12章 表示层的测试第13Ajax测试第14章 使用Cactus进行服务器端的Java测试 第15章 测试JSF应用程序第16章 测试OSGi组件第17章 测试数据库访问第18章 测试基于JPA的应用程序第19JUnit的其他用法附录A JUnit 3JUnit 4之间的不同附录B 使用自定义的运行器和匹配器扩展JUnitAPI附录C 本书源代码 附录D JUnit IDE集成附录E 安装软件

Atitit junit最佳实践

目录

1.1. 可以在包级别建立测试,避免太多的test class 1

1.2. 但文件独立方法测试 避免建立太多的class 1

1.3. 测试方法直接从bat执行 取代main模式 2

1.4. 可以单独做方法测试  单独执行一个方法,避免main模式 2

1.5. class内执行 2

2. Junit的不足 2

2.1. 必须要void返回?? 2

2.2. Static 模式方法执行 2

2.3. 必须要public?? 2

2.4. 待参数方法执行 2

3. Qa 2

3.1. Ini err 2

4. Main测试的问题 3

4.1. 不能直接在方法上右键run,导致main和方法距离较远,不能一个实现看到 3

4.2. 单独执行多个方法,需要修改多次main 指定切换 3

5. Ref 3

1.1. 可以在包级别建立测试,避免太多的test class

1.2. 但文件独立方法测试 避免建立太多的class

protected static void moveDir2dest(File strFileName, String dest) {

// TODO Auto-generated method stub

}

@Test

protected static void test_moveDir2dest(File strFileName, String dest) {

// TODO Auto-generated method stub

}

1.3. 测试方法直接从bat执行 取代main模式

1.4. 可以单独做方法测试  单独执行一个方法,避免main模式

1.5. class内执行

可以在本class内执行 。。貌似必须void public  并且非static ???

2. Junit的不足

2.1. 必须要void返回 valied

2.2. Static 模式方法执行 valied

2.3. 必须要public??

2.4. 待参数方法执行

3.  Qa

3.1. Ini err

Mubst  no has param

Must not static method

4. Main测试的问题

4.1. 不能直接在方法上右键run,导致main和方法距离较远,不能一个实现看到

4.2. 单独执行多个方法,需要修改多次main 指定切换

5. Ref

Atitit unit test junit useage

Atitit 提升用户体验与开发效率的好工具junit

可以单独做方法测试

JUnit实战_360百科.html

1部分 认识JUnit1JUnit起步第2章 探索JUnit的核心第3章 掌握JUnit4章 软件测试原则 第2部分 不同的测试策略第5章 测试覆盖率与开发第6章 使用stub进行粗粒度测试第7章 使用mock objects进行测试第8章 容器内测试 第3部分 JUnit与构建过程第9章 从Ant中运行JUnit测试第10章 从Maven2中运行JUnit测试第11章 持续集成工具 第4部分 JUnit扩展第12章 表示层的测试第13Ajax测试第14章 使用Cactus进行服务器端的Java测试 第15章 测试JSF应用程序第16章 测试OSGi组件第17章 测试数据库访问第18章 测试基于JPA的应用程序第19JUnit的其他用法附录A JUnit 3JUnit 4之间的不同附录B 使用自定义的运行器和匹配器扩展JUnitAPI附录C 本书源代码 附录D JUnit IDE集成附录E 安装软件

原文地址:https://www.cnblogs.com/attilax/p/15197608.html