我正在尝试构建一个AutoTest脚本,该脚本从git中获取我的项目,然后在测试项目中运行测试,而不必使用任何模拟器或真正的设备。
我下载了这两个项目,让它们位于相同的dir中,并运行以下命令:
$ android update project -p Labyrinth -n Labyrinth
Updated local.properties
Added file Labyrinth/build.xml
Updated file Labyrinth/proguard-project.txt
$ android update test-project -m ../Labyrinth -p LabyrinthTest/
Resolved location of main project to: /home/me/labyrinth-temp/Labyrinth
Updated project.properties
Updated local.properties
Added file LabyrinthTest/build.xml
Updated file LabyrinthTest/proguard-project.txt
Updated ant.properties
Buildfile: /home/me/labyrinth-temp/LabyrinthTest/build.xml然后,当我进入LabyrinthTest文件夹并尝试运行测试时,我得到以下信息:
$ ant run-tests
BUILD FAILED
Target "run-tests" does not exist in the project "LabyrinthTest".
Total time: 0 seconds在过去的3-4个小时里,我搜索并尝试了所有我能找到的东西,没有任何进展。但是,使用模拟器运行"ant test“是有效的!但我想不用它就行。
$ ant test
Buildfile: /home/me/labyrinth-temp/LabyrinthTest/build.xml
-test-project-check:
test:
[echo] Running tests ...
[exec]
[exec] com.app.labyrinth.test.BallTest:...
[exec] Test results for InstrumentationTestRunner=...
[exec] Time: 0.034
[exec]
[exec] OK (3 tests)
[exec]
[exec] 成功构建总时间:1秒
如果需要这些资料:
Android API version used: 7 (2.1 Eclair)
Android SDK Tools version: 18
Apache Ant(TM) version 1.8.3 compiled on May 17 2012发布于 2012-05-18 00:57:56
当模拟器没有运行时,您没有告诉什么不工作,所以我猜问题是(假设adb devices将您的设备显示为在线),您还没有在ant命令行中指定序列号如下:
$ ant -Dadb.device.arg="-s 0123456789" testhttps://stackoverflow.com/questions/10643810
复制相似问题