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
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" />
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.
Here's the error:
test-run:
[junit] Test com.mark.prototype.test.SampleAndroidAppTest FAILED
compile-and-test:
BUILD SUCCESSFUL
Total time: 3 seconds
Can't figure out why it's failing in Ant.
最好的方法是通过Export创建自动ant构建,然后选择Ant BuildFiles,然后根据您的要求进行修改。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.