add plan for mybatis mock function

This commit is contained in:
金戟 2021-05-03 10:37:33 +08:00
parent 1da98a0364
commit 7cda8ffd36
4 changed files with 17 additions and 5 deletions

View File

@ -6,7 +6,8 @@ Use TestableMock
- [Quickly mock arbitrary call](en-us/doc/use-mock.md): quickly replace any method invocation in the class under test with a mock method, solve the cumbersome use of traditional mock tools problem
- [Access private members of the class under test](en-us/doc/private-accessor.md): enable unit tests directly invoke or access private members of the class under test, solve the problems of private member initialization and private method testing
- [Quickly construct complicated parameter object](en-us/doc/omni-constructor.md)generate arbitrarily nested object instances, simplify their internal member assignment methods, solve the problem of long initialization codes for method parameters
- [Auxiliary test void method](en-us/doc/test-void-method.md): use the mock validator to check the internal logic of method, solve the problem that unit testing is difficult to implement to the method with no return value
- [Assist test void method](en-us/doc/test-void-method.md): use the mock validator to check the internal logic of method, solve the problem that unit testing is difficult to implement to the method with no return value
- [Assist test SQL generated by mybatis](en-us/doc/test-mybatis-sql.md): provide built-in mock implementation for mybatis, solve the problem that the logic in data-access-object (DAO) layer cannot be tested directly
## Use in Maven project
@ -78,7 +79,7 @@ test {
See the [build.gradle](https://github.com/alibaba/testable-mock/blob/master/demo/java-demo/build.gradle) file of project `java-demo` and the [build.gradle.kts](https://github.com/alibaba/testable-mock/blob/master/demo/kotlin-demo/build.gradle.kts) file of project `kotlin-demo`.
> For Android project tested with `Robolectric` framework, please use the same method to add `TestableMock` dependency as above, and add `javaagent` configuration as follows:
> For Android project, please use the same method to add `TestableMock` dependency as above, and add `javaagent` configuration as follows:
>
> ```groovy
> android {
@ -92,7 +93,7 @@ See the [build.gradle](https://github.com/alibaba/testable-mock/blob/master/demo
> }
> ```
>
> See [issue-43](https://github.com/alibaba/testable-mock/issues/43) for a complete example.
> See project `demo/android-demo` for a complete example.
> If the project is using `Spock` test framework, you need to specify the bytecode version generated by `Groovy` to be 1.6 or above, the method is as follows (please modify the properties value according to the actual JVM version used).
>

View File

@ -0,0 +1,4 @@
Test Data Access Object
---
Plan to coming in version `0.7`.

View File

@ -7,6 +7,7 @@
- [访问被测类私有成员](zh-cn/doc/private-accessor.md):使单元测试能直接调用和访问被测类的私有成员,解决私有成员初始化和私有方法测试的问题
- [快速构造参数对象](zh-cn/doc/omni-constructor.md):生成任意复杂嵌套的对象实例,并简化其内部成员赋值方式,解决被测方法参数初始化代码冗长的问题
- [辅助测试void方法](zh-cn/doc/test-void-method.md)利用Mock校验器对方法的内部逻辑进行检查解决无返回值方法难以实施单元测试的问题
- [快速测试数据库SQL](zh-cn/doc/test-mybatis-sql.md)通过内置针对性的Mock实现解决基于Mybatis的数据访问层(DAO层)代码逻辑无法直接测试的问题
## 在Maven项目中使用
@ -78,7 +79,7 @@ test {
参见项目`java-demo`的[build.gradle](https://github.com/alibaba/testable-mock/blob/master/demo/java-demo/build.gradle)和`kotlin-demo`的[build.gradle.kts](https://github.com/alibaba/testable-mock/blob/master/demo/kotlin-demo/build.gradle.kts)文件。
> 若是基于`Robolectric`框架的Android项目则添加`TestableMock`依赖方法同上添加javaagent配置方法如下
> 若用于Android项目则添加`TestableMock`依赖方法同上添加javaagent配置方法如下
>
> ```groovy
> android {
@ -92,7 +93,7 @@ test {
> }
> ```
>
> 完整示例参考[issue-43](https://github.com/alibaba/testable-mock/issues/43)
> 完整代码可参考`demo/android-demo`示例项目。
> 若项目使用`Spock`测试框架,需指定`Groovy`编译生成的JVM 1.6或以上版本字节码方法如下请根据实际使用的JVM版本修改属性值
>

View File

@ -0,0 +1,6 @@
测试数据访问层逻辑
---
由于数据库的访问本质上属于外部调用因此在单元测试中往往被作为Mock的目标导致DAO层逻辑很容易成为单元测试盲区。为此`TestableMock`通过针对`Mybatis`内部逻辑的精准Mock提供按需拦截和验证实际SQL语句的功能。
计划在`0.7`版本中推出。