使用Ant构建项目并运行JUnit测试Android应用程序,但蚂蚁JUnit测试失败 [英] Using Ant to build project and run JUnit Test Android app but Ant Junit Test fails

查看:241
本文介绍了使用Ant构建项目并运行JUnit测试Android应用程序,但蚂蚁JUnit测试失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我创建了一个简单的Andr​​oid项目。我还创建Junit的情况下,该项目。我有我在同一个项目Android应用程序和的TestCase。我的结构如下所示:

I have a simple Android project that I created. I also created Junit cases for the project. I have my Android app and TestCases in the same project. My structure is like the following:

-AndroidApp
    -src
       -SampleActivity
    -tests
       -SampleActivityTest

我已经改变了秩序和导出选项,并确保JUnit是在顶部。结果
我已经加入

I have changed the Order and export options and made sure JUnit is at the top.
I have added

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

运行Android的JUnit测试在Eclipse中工作正常,但是当我尝试建立和放大器; JUnit测试与蚂蚁应用项目/应用程序构建,但测试失败。

Running Android JUnit Test works fine in Eclipse, but when I try to build & Junit Test the app with Ant the project/app builds but the test fails.

下面的错误:

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

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

想不通为什么它在Ant中失败。

Can't figure out why it's failing in Ant.

推荐答案

最好的办法是通过出口自动创建Ant构建然后根据您的需求选择Ant构建文件,然后修改它。

Best way is create auto ant build via Export then select Ant BuildFiles and then modify it according to your requirement.

这篇关于使用Ant构建项目并运行JUnit测试Android应用程序,但蚂蚁JUnit测试失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆