gpt4 book ai didi

java - Maven 不会运行 Android 仪器测试

转载 作者:行者123 更新时间:2023-12-01 14:00:14 24 4
gpt4 key购买 nike

如何使用 jayway 的 maven-android-plugin 运行 Android 仪器测试以进行自动测试?

我查看了apidemos-android-16并使用 mvn clean install 运行它们,但只执行了 7 个单元测试。例如,Focus2ActivityTest 未运行。 mvn android:instrument 给出相同的结果。

Maven 输出:

[INFO] Found 1 devices connected with the Android Debug Bridge
[INFO] android.device parameter not set, using all attached devices
[INFO] Emulator emulator-5554_myDefaultAVD_unknown_google_sdk found.
[INFO] emulator-5554_myDefaultAVD_unknown_google_sdk : Successfully installed C:\dev\jayway-maven-android-plugin-samples\apidemos-android-16\instrumen
tationtests\target\instrumentationtests-1.0.0-SNAPSHOT.apk to emulator-5554_myDefaultAVD_unknown_google_sdk
[INFO]
[INFO] --- android-maven-plugin:3.7.0:internal-integration-test (default-internal-integration-test) @ instrumentationtests ---
[INFO] Found 1 devices connected with the Android Debug Bridge
[INFO] android.device parameter not set, using all attached devices
[INFO] Emulator emulator-5554_myDefaultAVD_unknown_google_sdk found.
[INFO] emulator-5554_myDefaultAVD_unknown_google_sdk : Running instrumentation tests in com.example.android.apis.tests
[INFO] emulator-5554_myDefaultAVD_unknown_google_sdk : Run started: com.example.android.apis.tests, 7 tests:
[INFO] emulator-5554_myDefaultAVD_unknown_google_sdk : Start [1/7]: com.example.android.apis.ApiDemosApplicationTests#testPreconditions
[INFO] emulator-5554_myDefaultAVD_unknown_google_sdk : End [1/7]: com.example.android.apis.ApiDemosApplicationTests#testPreconditions
[INFO] emulator-5554_myDefaultAVD_unknown_google_sdk : Start [2/7]: com.example.android.apis.app.LocalServiceTest#testPreconditions
[INFO] emulator-5554_myDefaultAVD_unknown_google_sdk : End [2/7]: com.example.android.apis.app.LocalServiceTest#testPreconditions
[INFO] emulator-5554_myDefaultAVD_unknown_google_sdk : Start [3/7]: com.example.android.apis.app.LocalServiceTest#testStartable
[INFO] emulator-5554_myDefaultAVD_unknown_google_sdk : End [3/7]: com.example.android.apis.app.LocalServiceTest#testStartable
[INFO] emulator-5554_myDefaultAVD_unknown_google_sdk : Start [4/7]: com.example.android.apis.os.MorseCodeConverterTest#testCharacterS
[INFO] emulator-5554_myDefaultAVD_unknown_google_sdk : End [4/7]: com.example.android.apis.os.MorseCodeConverterTest#testCharacterS
[INFO] emulator-5554_myDefaultAVD_unknown_google_sdk : Start [5/7]: com.example.android.apis.view.Focus2AndroidTest#testGoingLeftFromRightButtonGoesToCent
er
[INFO] emulator-5554_myDefaultAVD_unknown_google_sdk : End [5/7]: com.example.android.apis.view.Focus2AndroidTest#testGoingLeftFromRightButtonGoesToCenter

[INFO] emulator-5554_myDefaultAVD_unknown_google_sdk : Start [6/7]: com.example.android.apis.view.Focus2AndroidTest#testGoingRightFromLeftButtonJumpsOverC
enterToRight
[INFO] emulator-5554_myDefaultAVD_unknown_google_sdk : End [6/7]: com.example.android.apis.view.Focus2AndroidTest#testGoingRightFromLeftButtonJumpsOverCen
terToRight
[INFO] emulator-5554_myDefaultAVD_unknown_google_sdk : Start [7/7]: com.example.android.apis.view.Focus2AndroidTest#testPreconditions
[INFO] emulator-5554_myDefaultAVD_unknown_google_sdk : End [7/7]: com.example.android.apis.view.Focus2AndroidTest#testPreconditions
[INFO] emulator-5554_myDefaultAVD_unknown_google_sdk : Run ended: 212 ms
[INFO] Tests run: 7, Failures: 0, Errors: 0
[INFO] emulator-5554_myDefaultAVD_unknown_google_sdk : Report file written to C:\dev\jayway-maven-android-plugin-samples\apidemos-android-16\instrumen
tationtests\target\surefire-reports\TEST-emulator-5554_myDefaultAVD_unknown_google_sdk.xml
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:05.798s
[INFO] Finished at: Tue Oct 15 22:26:49 CEST 2013
[INFO] Final Memory: 23M/350M
[INFO] ------------------------------------------------------------------------

我的maven版本:

Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 14:51:28+0100)
Maven home: C:\dev\apache-maven-3.0.5\bin..
Java version: 1.7.0_25, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_25\jre
Default locale: de_DE, platform encoding: Cp1252
OS name: "windows 8", version: "6.2", arch: "amd64", family: "windows"

我在 pom.xml 中尝试了几次配置更改,但没有成功。怎么了?

最佳答案

我相信它工作正常。 Activity 测试未运行的原因是它们是“中型”测试,并且测试配置被配置为仅运行“小型”测试。

参见https://github.com/jayway/maven-android-plugin-samples/blob/master/apidemos-android-16/instrumentationtests/pom.xml

具体

 <configuration>
<test>
<testSize>small</testSize>

关于java - Maven 不会运行 Android 仪器测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19390532/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com