单元测试介绍
原文:https://www.codingapi.com/docs/codingapi-test/
通常单元测试要达到的效果:
- 检验代码是否可以正常工作
- 要达到业务层率覆盖率100%
- 不依赖其他模块与数据可独立运行
- 执行测试以后不允许产生脏数据影响业务
- 要对业务产生的影响做检验确认
codingapi-test框架
框架基于Springboot2.x研发,可快速准备数据、校验数据、清理数据的测试工具。
使用codingapi-test框架的理由:
- 方便快捷的准备测试数据
- 自动化的校验
- 自动化的清理数据
- 兼容MongoDB、MySQL(关系型)
github:
https://github.com/codingapi/codingapi-test
maven:
<dependency>
<groupId>com.codingapi</groupId>
<artifactId>codingapi-test</artifactId>
<version>0.0.1</version>
</dependency>
配置说明
@TestMethod
提供了对单元测