add self troubleshooting information

This commit is contained in:
金戟 2021-02-02 14:24:12 +08:00
parent f228ed5002
commit b23b8b98b3
2 changed files with 12 additions and 0 deletions

View File

@ -38,3 +38,9 @@ The output log example is as follows:
``` ```
The log shows all the mocked invocation and corresponding code line numbers in the class under test. The log shows all the mocked invocation and corresponding code line numbers in the class under test.
- Self troubleshooting:
- If there is no output, please check whether the `pom.xml` or `build.gradle` configuration correctly introduces `TestableMock` dependencies
- If only the first line of `Handling test class` is output, please check whether the test class is in the same package of the class under test, and the name is "<ClassUnderTest>+Test" (required for `0.4.x` version)
- If `Handling source class` and `Handling method xxx` are output, but there is no mock replacement happen at the expected code line, please check whether the mock method definition matches the target method

View File

@ -38,3 +38,9 @@ class DemoTest {
``` ```
该日志展示了被测类中所有发生了Mock替换的调用和相应代码行号。 该日志展示了被测类中所有发生了Mock替换的调用和相应代码行号。
简单排查方法:
- 若没有任何输出,请检查`pom.xml`或`build.gradle`配置是否正确引入了TestableMock依赖
- 若只输出了第一行`Handling test class`,请检查被测类与测试类是否包路径相同,且名称为"被测类+Test"`0.4.x`版本要求)
- 若输出了`Handling source class`以及`Handling method xxx`但预期的代码行位置没有发生Mock替换请检查Mock方法定义是否未与目标方法匹配