如何使用ant运行android lib的unittests?
作者:互联网
我有一个android lib项目和一个我在eclipse中构建的android测试项目.
现在,我正在自动化流程,尝试使用ant运行测试时遇到了问题.
当我运行测试项目的“运行测试”目标时,它声称lib项目没有“安装目标”.
C:\Code4\Main\AndroidMyAppLibTest>ant run-tests
Buildfile: C:\Code4\Main\AndroidMyAppLibTest\build.xml
[setup] Android SDK Tools Revision 11
[setup] Project Target: Android 2.3.3
[setup] API level: 10
[setup]
[setup] ------------------
[setup] Resolving library dependencies:
[setup] C:\Code4\Main\AndroidMyAppLibTest: ../AndroidMyAppLib => C:\Code4\Main\AndroidMyAppLib
[setup] C:\Code4\Main\AndroidMyAppLibTest: ../AndroidMyAppMocksLib => C:\Code4\Main\AndroidMyAppMocksLib
[setup] C:\Code4\Main\AndroidMyAppMocksLib: ../AndroidMyAppLib => C:\Code4\Main\AndroidMyAppLib
[setup] ------------------
[setup] Ordered libraries:
[setup] C:\Code4\Main\AndroidMyAppMocksLib
[setup] C:\Code4\Main\AndroidMyAppLib
[setup] ------------------
[setup]
[setup]
[setup] Importing rules file: tools\ant\test_rules.xml
-install-tested-project:
[setup] Android SDK Tools Revision 11
[setup] Project Target: Android 2.3.3
[setup] API level: 10
[setup] Project Type: Android Library
[setup]
[setup] ------------------
[setup] Resolving library dependencies:
[setup] No library dependencies.
[setup]
[setup] ------------------
[setup]
[setup] WARNING: No minSdkVersion value set. Application will install on all Android versions.
[setup]
[setup] Importing rules file: tools\ant\lib_rules.xml
Duplicated project name in import. Project android_rules defined first in C:\eclipse\android-sdk_r11-windows\android-sdk-windows\tools\ant\main_rules.xml and again in C:\eclipse\android-sdk_r11-windows\android-sdk-windows\tools\ant\lib_rules.xml
BUILD FAILED
C:\eclipse\android-sdk_r11-windows\android-sdk-windows\tools\ant\test_rules.xml:51: The following error occurred while executing this line:
Target "install" does not exist in the project "AndroidMyAppLib".
我没想到库会被安装,(它是一个库而不是apk),但是android_rules试图安装它并失败了.
我是否需要为测试目标库而不是应用程序配置一些特殊的东西?
谢谢!
解决方法:
这里有关于如何实现此目的的描述:
http://www.paulbutcher.com/2010/09/android-library-project-with-tests-step-by-step/
标签:unit-testing,automated-tests,android,ant 来源: https://codeday.me/bug/20191208/2089788.html