mirror of
https://github.com/alibaba/testable-mock.git
synced 2026-08-19 09:43:29 +08:00
release version 0.4.7
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
阅读[这里](https://mp.weixin.qq.com/s/KyU6Eu7mDkZU8FspfSqfMw)了解更多故事。
|
||||
|
||||
> 特别说明
|
||||
> 1. 如有遇到启动报空指针异常问题,请升级`TestableMock`版本,这是BUG,已修复😛
|
||||
> 1. 如有遇到启动报空指针异常或"Operand stack overflow"错误,请升级`TestableMock`版本,这是BUG,已修复😛
|
||||
> 2. 如遇到"Attempt to access none-static member in mock method"错误,参见[常见问题](https://alibaba.github.io/testable-mock/#/zh-cn/doc/frequently-asked-questions)第8条
|
||||
> 3. 如果有遇到其他任何使用问题,请直接在[Issue](https://github.com/alibaba/testable-mock/issues)中提出,我们将在24小时内回复并处理
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ repositories {
|
||||
|
||||
dependencies {
|
||||
testImplementation('org.junit.jupiter:junit-jupiter:5.6.2')
|
||||
testImplementation('com.alibaba.testable:testable-all:0.4.6')
|
||||
testAnnotationProcessor('com.alibaba.testable:testable-processor:0.4.6')
|
||||
testImplementation('com.alibaba.testable:testable-all:0.4.7')
|
||||
testAnnotationProcessor('com.alibaba.testable:testable-processor:0.4.7')
|
||||
}
|
||||
|
||||
test {
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<junit.version>5.6.2</junit.version>
|
||||
<testable.version>0.4.6</testable.version>
|
||||
<testable.version>0.4.7</testable.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -16,8 +16,8 @@ dependencies {
|
||||
implementation("org.jetbrains.kotlin:kotlin-reflect")
|
||||
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
|
||||
testImplementation("org.junit.jupiter:junit-jupiter:5.6.2")
|
||||
testImplementation("com.alibaba.testable:testable-all:0.4.6")
|
||||
testAnnotationProcessor("com.alibaba.testable:testable-processor:0.4.6")
|
||||
testImplementation("com.alibaba.testable:testable-all:0.4.7")
|
||||
testAnnotationProcessor("com.alibaba.testable:testable-processor:0.4.7")
|
||||
}
|
||||
|
||||
tasks.withType<KotlinCompile> {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<junit.version>5.6.2</junit.version>
|
||||
<testable.version>0.4.6</testable.version>
|
||||
<testable.version>0.4.7</testable.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -46,3 +46,23 @@ For example, some private methods and external invocation in the `Aaa` class are
|
||||
It can be used in combination with [Roboelectric](https://github.com/robolectric/robolectric) testing framework.
|
||||
|
||||
The `Dalvik` and `ART` virtual machines of the Android system use a bytecode system different from the standard JVM, which will affect the normal functionality of `TestableMock`. The `Roboelectric` framework can run Android unit tests on a standard JVM virtual machine, which is much faster than running unit tests through the Android virtual machine. Recently, most Android App unit tests are written with the `Roboelectric` framework.
|
||||
|
||||
#### 8. Meet "Attempt to access none-static member in mock method" error during mocking?
|
||||
|
||||
The current design of `TestableMock` does not allow access to the non-`static` members of the test class in the mock method (because the mock method itself will be dynamically modified to the `static` type during runtime). However, some Java statements include building blocks (like `new ArrayList<String>() {{ append("data"); }}`), lambda expression (like `list.stream().map(i -> i. get)`) and so on, will generate additional member method invocations during compilation, causing mock method execution report above error.
|
||||
|
||||
The simplest solution is to declare the mock method itself as a `static` type (so that dynamically generated invocation will also be `static` to avoid the errors), for example, the original method is defined as:
|
||||
|
||||
```java
|
||||
@MockMethod
|
||||
private int getXxx(Demo self) {}
|
||||
```
|
||||
|
||||
Modify it to:
|
||||
|
||||
```java
|
||||
@MockMethod
|
||||
private static int getXxx(Demo self) {}
|
||||
```
|
||||
|
||||
In the next major iteration (**i.e. `v0.5`**), the mock implementation mechanism will be modified while maintaining the current mock experience. Then, it will be no longer necessary to modify the mock method to a static method, and completely solving this problem.
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
# Release Note
|
||||
|
||||
## 0.4.7
|
||||
- Fix incorrect stack size caused by `MOCK_CONTEXT` variable initialization
|
||||
- Fix incorrect gradle build path of under Windows operating system
|
||||
|
||||
## 0.4.6
|
||||
- fix an issue of `IINC` bytecode processing
|
||||
- support `TestableTool.MOCK_CONTEXT` variable to inject extra parameters to mock context
|
||||
|
||||
@@ -15,7 +15,7 @@ It is recommended to add a `property` field that identifies the TestableMock ver
|
||||
|
||||
```xml
|
||||
<properties>
|
||||
<testable.version>0.4.6</testable.version>
|
||||
<testable.version>0.4.7</testable.version>
|
||||
</properties>
|
||||
```
|
||||
|
||||
@@ -62,8 +62,8 @@ Add dependence of `TestableMock` in `build.gradle` file:
|
||||
|
||||
```groovy
|
||||
dependencies {
|
||||
testImplementation('com.alibaba.testable:testable-all:0.4.6')
|
||||
testAnnotationProcessor('com.alibaba.testable:testable-processor:0.4.6')
|
||||
testImplementation('com.alibaba.testable:testable-all:0.4.7')
|
||||
testAnnotationProcessor('com.alibaba.testable:testable-processor:0.4.7')
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -65,4 +65,4 @@ private int getXxx(Demo self) {}
|
||||
private static int getXxx(Demo self) {}
|
||||
```
|
||||
|
||||
在下一个大迭代版本(即`0.5`版本)中,将会在保持当前Mock体验的前提下,对Mock的实现机制进行修改,不再需要修改Mock方法为静态方法,从而彻底解决此类报错问题。
|
||||
在下一个大迭代版本(**即`0.5`版本**)中,将会在保持当前Mock体验的前提下,对Mock的实现机制进行修改,不再需要修改Mock方法为静态方法,从而彻底解决此类报错问题。
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
# Release Note
|
||||
|
||||
## 0.4.7
|
||||
- 修复由于`MOCK_CONTEXT`引入的堆栈大小错误
|
||||
- 修复Windows下的`Gradle`构建路径错误
|
||||
|
||||
## 0.4.6
|
||||
- 修复一处`IINC`字节码处理异常
|
||||
- 支持使用`TestableTool.MOCK_CONTEXT`变量为Mock方法注入额外上下文参数
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
```xml
|
||||
<properties>
|
||||
<testable.version>0.4.6</testable.version>
|
||||
<testable.version>0.4.7</testable.version>
|
||||
</properties>
|
||||
```
|
||||
|
||||
@@ -62,8 +62,8 @@
|
||||
|
||||
```groovy
|
||||
dependencies {
|
||||
testImplementation('com.alibaba.testable:testable-all:0.4.6')
|
||||
testAnnotationProcessor('com.alibaba.testable:testable-processor:0.4.6')
|
||||
testImplementation('com.alibaba.testable:testable-all:0.4.7')
|
||||
testAnnotationProcessor('com.alibaba.testable:testable-processor:0.4.7')
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.alibaba.testable</groupId>
|
||||
<artifactId>testable-parent</artifactId>
|
||||
<version>0.4.6</version>
|
||||
<version>0.4.7</version>
|
||||
<relativePath>../testable-parent</relativePath>
|
||||
</parent>
|
||||
<artifactId>testable-agent</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.alibaba.testable</groupId>
|
||||
<artifactId>testable-parent</artifactId>
|
||||
<version>0.4.6</version>
|
||||
<version>0.4.7</version>
|
||||
<relativePath>../testable-parent</relativePath>
|
||||
</parent>
|
||||
<artifactId>testable-all</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.alibaba.testable</groupId>
|
||||
<artifactId>testable-parent</artifactId>
|
||||
<version>0.4.6</version>
|
||||
<version>0.4.7</version>
|
||||
<relativePath>../testable-parent</relativePath>
|
||||
</parent>
|
||||
<artifactId>testable-core</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.alibaba.testable</groupId>
|
||||
<artifactId>testable-parent</artifactId>
|
||||
<version>0.4.6</version>
|
||||
<version>0.4.7</version>
|
||||
<relativePath>../testable-parent</relativePath>
|
||||
</parent>
|
||||
<artifactId>testable-maven-plugin</artifactId>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.alibaba.testable</groupId>
|
||||
<artifactId>testable-parent</artifactId>
|
||||
<version>0.4.6</version>
|
||||
<version>0.4.7</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>testable-parent</name>
|
||||
<description>Unit test enhancement toolkit</description>
|
||||
@@ -42,7 +42,7 @@
|
||||
<plugin.gpg.version>1.6</plugin.gpg.version>
|
||||
<plugin.staging.version>1.6.8</plugin.staging.version>
|
||||
<plugin.maven.version>3.6.0</plugin.maven.version>
|
||||
<testable.version>0.4.6</testable.version>
|
||||
<testable.version>0.4.7</testable.version>
|
||||
</properties>
|
||||
|
||||
<profiles>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.alibaba.testable</groupId>
|
||||
<artifactId>testable-parent</artifactId>
|
||||
<version>0.4.6</version>
|
||||
<version>0.4.7</version>
|
||||
<relativePath>../testable-parent</relativePath>
|
||||
</parent>
|
||||
<artifactId>testable-processor</artifactId>
|
||||
|
||||
Reference in New Issue
Block a user