繁体   English   中英

使用Ant构建项目并运行JUnit Test Android应用程序,但Ant Junit Test失败

[英]Using Ant to build project and run JUnit Test Android app but Ant Junit Test fails

我有一个我创建的简单Android项目。 我还为该项目创建了Junit案例。 我在同一个项目中安装了我的Android应用程序和TestCases。 我的结构如下:

-AndroidApp
    -src
       -SampleActivity
    -tests
       -SampleActivityTest

我已经更改了Order和export选项,并确保JUnit位于顶部。
我已经添加了

<instrumentation android:name="android.test.InstrumentationTestRunner"
android:targetPackage="com.sample.app"
android:label="UnitTest" />
<uses-library android:name="android.test.runner" />

运行Android JUnit Test在Eclipse中运行良好,但是当我尝试使用Ant构建&Junit测试应用程序时,项目/应用程序构建但测试失败。

这是错误:

test-run:
       [junit] Test com.mark.prototype.test.SampleAndroidAppTest FAILED

compile-and-test:
BUILD SUCCESSFUL
Total time: 3 seconds

无法弄清楚为什么它在Ant中失败了。

最好的方法是通过Export创建自动ant构建,然后选择Ant BuildFiles,然后根据您的要求进行修改。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM