【问题标题】:Android instrumentation doesn't see my unit testsAndroid 仪器没有看到我的单元测试
【发布时间】:2011-05-27 10:10:39
【问题描述】:

我使用http://code.google.com/p/the-missing-android-xml-junit-test-runner/ 在jenkins 环境中运行单元测试。

一个示例项目运行良好,但另一个示例项目却出现了奇怪的结果。 蚂蚁输出

[echo] Running tests ...
[exec]
[exec] Test results for PolideaInstrumentationTestRunner=
[exec] Time: 0.0
[exec]
[exec] OK (0 tests)
[exec]
[exec]

adb shell am instrument -w com.mypack.tests/pl.polidea.instrumentation.PolideaInstrumentationTestRunner 也是如此。

它认为没有测试但有。他们成功地从 eclipse 运行。

【问题讨论】:

  • 试试 android.test.InstrumentationTestRunner 来检测你的问题出在哪里。
  • 知道了!试图找出可行的项目和不可行的项目之间的差异。

标签: android unit-testing ant jenkins


【解决方案1】:

原因是: 在 build.properties 中有相对的 source.dir。比如:

source.dir=src;./../../../other.package/src;./../../and.other/src

它编译得很好,但阻止了测试运行。当我将路径设置为绝对路径时:

source.dir=${workspace}/my.package/src;${workspace}/other.package/src;${workspace}/and.other/src

测试确实运行。

【讨论】:

    猜你喜欢
    • 2014-05-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-01
    • 1970-01-01
    相关资源
    最近更新 更多