我尝试将我的Robotium测试集成到我们的Jenkins服务器上。我实现了一个基于我们的应用程序项目的Android测试项目。当我在Eclipse上从我的本地计算机上运行测试时,一切都像魅力一样,也可以通过逐个调用来调用
'adb shell am instrument -w <our-package>/android.test.InstrumentationTestRunner'
到目前为止,非常好,但在我在Jenkins中设置构建作业后,让我们通过maven清理安装标志等构建项目。我的测试都不会进行。我还尝试在构建步骤之后将'adb shell am instrument -w <our-package>/android.test.InstrumentationTestRunner'
作为shell命令调用,但也没有结果。最终只有2个测试显示在下面的日志
[workspace] $ /bin/sh -xe /tmp/hudson3571502822112946903.sh
+ /home/jenkins/tools/android-sdk-linux/platform-tools/adb shell pm list instrumentation
instrumentation:com.android.emulator.connectivity.test/android.test.InstrumentationTestRunner (target=com.android.emulator.connectivity.test)
instrumentation:com.android.emulator.gps.test/android.test.InstrumentationTestRunner (target=com.android.emulator.gps.test)
instrumentation:com.zeppelin.zemos.test.addispo/android.test.InstrumentationTestRunner (target=com.zeppelin.zemos.addispo)
+ /home/jenkins/tools/android-sdk-linux/platform-tools/adb shell am instrument -w com.zeppelin.zemos.test.addispo/android.test.InstrumentationTestRunner
android.test.AndroidTestCase:.
android.test.LoaderTestCase:.
Test results for InstrumentationTestRunner=..
Time: 0.031
OK (2 tests)
只显示2次测试AndroidTestCase和LoaderTestCase,似乎所有其他测试用例(我已经实现了11)都没有被Jenkins处理。
我花了很长时间在谷歌搜索,但没有找到解决方案。这可能是一个蚂蚁问题吗?我在Jenkins服务器上有本地版本1.8和1.6。还是有另一个我看不到的问题......
非常感谢
答案 0 :(得分:1)
您可以尝试使用从设备/模拟器卸载软件包 “adb uninstall your_package” 然后,再次执行干净的调试安装,然后运行测试。