Mac系统下eclipse不能正常执行ios测试用例
问题:使用InstrumentDriver框架做ios自动化测试时,eclipse不能正常执行ios测试用例,每次执行printElementTree时都会超时,如下图所示:
分析:eclipse找不到设备。测试项目中athrun.properties文件中的isRunSimulator的值为true(实际上应该为false),导致InstrumentDriver框架中的runTests.sh文件最终执行的命令是:
instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate -D instrumentsDriver /Users/qinhuang/Library/Developer/Xcode/DerivedData/TaoTest-crxfytdmxwvbavfwuazuwlgpjuxi/Build/Products/Debug-iphoneos/TaoTest.app -e UIASCRIPT /Users/qinhuang/InstrumentDriver/CSRunner.js -e UIARESULTSPATH /Users/qinhuang/InstrumentDriver/log/ -v
而实际上应该为:
instruments -w udid -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate -D instrumentsDriver /Users/qinhuang/Library/Developer/Xcode/DerivedData/TaoTest-crxfytdmxwvbavfwuazuwlgpjuxi/Build/Products/Debug-iphoneos/TaoTest.app -e UIASCRIPT /Users/qinhuang/InstrumentDriver/CSRunner.js -e UIARESULTSPATH /Users/qinhuang/InstrumentDriver/log/ -v
解决方法:将测试项目中athrun.properties文件中的isRunSimulator的值改为false