I use http://code.google开发者_开发技巧.com/p/the-missing-android-xml-junit-test-runner/ to run unit tests in jenkins environment.
One sample project worked well, but for another there are strange results. Ant outputs
[echo] Running tests ...
[exec]
[exec] Test results for PolideaInstrumentationTestRunner=
[exec] Time: 0.0
[exec]
[exec] OK (0 tests)
[exec]
[exec]
and so does adb shell am instrument -w com.mypack.tests/pl.polidea.instrumentation.PolideaInstrumentationTestRunner.
It thinks that there are no tests but there are. They successfully run from eclipse.
The reason was: in build.properties there was relative source.dir. Something like:
source.dir=src;./../../../other.package/src;./../../and.other/src
It compiled well, but prevented tests to run. When I set paths to absolute:
source.dir=${workspace}/my.package/src;${workspace}/other.package/src;${workspace}/and.other/src
tests do run.
精彩评论