From 1da98a0364e05844785f7954e9f0d3aa0cec45ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=87=91=E6=88=9F?= Date: Mon, 3 May 2021 09:30:23 +0800 Subject: [PATCH] small fix for android demo --- .../android-demo/app/src/test/resources/testable.properties | 3 +-- docs/en-us/doc/frequently-asked-questions.md | 6 ++++-- docs/zh-cn/doc/frequently-asked-questions.md | 4 ++-- tool/bump-to-next-release.sh | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/demo/android-demo/app/src/test/resources/testable.properties b/demo/android-demo/app/src/test/resources/testable.properties index f043a90..58ed4af 100644 --- a/demo/android-demo/app/src/test/resources/testable.properties +++ b/demo/android-demo/app/src/test/resources/testable.properties @@ -1,2 +1 @@ -omni.constructor.enhance.enable = true -omni.constructor.enhance.pkgPrefix.excludes = org.robolectric +log.file = null diff --git a/docs/en-us/doc/frequently-asked-questions.md b/docs/en-us/doc/frequently-asked-questions.md index e72ff34..ea8121c 100644 --- a/docs/en-us/doc/frequently-asked-questions.md +++ b/docs/en-us/doc/frequently-asked-questions.md @@ -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? diff --git a/docs/zh-cn/doc/frequently-asked-questions.md b/docs/zh-cn/doc/frequently-asked-questions.md index ba042f0..3a73731 100644 --- a/docs/zh-cn/doc/frequently-asked-questions.md +++ b/docs/zh-cn/doc/frequently-asked-questions.md @@ -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 ..."错误? diff --git a/tool/bump-to-next-release.sh b/tool/bump-to-next-release.sh index e0f7d91..89871af 100755 --- a/tool/bump-to-next-release.sh +++ b/tool/bump-to-next-release.sh @@ -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>/${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