small fix for android demo

This commit is contained in:
金戟 2021-05-03 09:30:23 +08:00
parent c6d892da2d
commit 1da98a0364
4 changed files with 8 additions and 7 deletions

View File

@ -1,2 +1 @@
omni.constructor.enhance.enable = true
omni.constructor.enhance.pkgPrefix.excludes = org.robolectric
log.file = null

View File

@ -51,9 +51,11 @@ In actual scenarios, there are very few scenarios where methods in the `String`
#### 8. Can `TestableMock` be used for testing Android projects?
It can be used in combination with [Roboelectric](https://github.com/robolectric/robolectric) testing framework.
Yes, check `demo/android-demo` project for more information.
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.
Please note, 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`.
If the test case require classes from Android SDK, it should be used in combination with [Roboelectric](https://github.com/robolectric/robolectric) testing framework.
This framework will run Android unit tests on a standard JVM virtual machine, which is much faster than running unit tests through the Android virtual machine, thus many Android App unit tests are written with the `Roboelectric` framework.
#### 9. Meet "Command Line is too Long. Shorten command line for ..." error when triggering test in IntelliJ IDE?

View File

@ -55,9 +55,9 @@ Kotlin语言中的`String`类型实际上是`kotlin.String`,而非`java.lang.S
#### 8. `TestableMock`能否用于Android项目的测试
结合[Roboelectric](https://github.com/robolectric/robolectric)测试框架可使用
可以,见`demo/android-demo`示例
Android系统的`Dalvik`和`ART`虚拟机采用了与标准JVM不同的字节码体系会影响`TestableMock`的正常工作。`Roboelectric`框架能在普通JVM虚拟机上运行Android单元测试其速度比通过Android虚拟机运行单元测试快非常多绝大多数Android App的单元测试都在使用`Roboelectric`框架。
需注意的是,Android系统的`Dalvik`和`ART`虚拟机采用了与标准JVM不同的字节码体系会影响`TestableMock`的正常工作。若测试中涉及Android SDK中的类型请结合[Roboelectric](https://github.com/robolectric/robolectric)测试框架使用该框架能在普通JVM虚拟机上运行Android单元测试且速度比通过Android虚拟机运行单元测试快非常多目前许多Android App的单元测试都在使用`Roboelectric`框架。
#### 9. 在IntelliJ运行测试报"Command Line is too Long. Shorten command line for ..."错误?

View File

@ -9,7 +9,7 @@ read -p "Next version should be: " NEXT
for pom in testable-all/pom.xml testable-maven-plugin/pom.xml testable-processor/pom.xml testable-agent/pom.xml testable-core/pom.xml testable-parent/pom.xml; do
sed -i '' "s/<version>${VERSION}<\/version>/<version>${NEXT}<\/version>/" $pom
done
for gradle in demo/java-demo/build.gradle demo/kotlin-demo/build.gradle.kts demo/spock-demo/build.gradle; do
for gradle in demo/java-demo/build.gradle demo/kotlin-demo/build.gradle.kts demo/spock-demo/build.gradle demo/android-demo/app/build.gradle; do
sed -i '' "s/testable-\([a-z]*\):${VERSION}/testable-\1:${NEXT}/" $gradle
done
for pom in testable-parent/pom.xml demo/java-demo/pom.xml demo/kotlin-demo/pom.xml demo/spock-demo/pom.xml; do