如何使用ant运行Android库的单元测试?

3

我有一个安卓库项目和一个在eclipse中构建的安卓测试项目。

现在我正在自动化这个过程,在尝试使用ant运行测试时遇到了问题。

当我运行测试项目的“run-tests”目标时,它声称库项目没有“install target”。

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尝试安装它并失败了。
我需要为测试库而非应用程序的测试目标进行特殊配置吗?
谢谢!
1个回答

3

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接