简体   繁体   English

如何在Ruby中执行adb shell命令?

[英]how to execute adb shell command in ruby?

I am trying to execute calabash-android test, in which i have one scenario that uses adb shell..and hence i have created method for the same in ruby as follows: 我正在尝试执行calabash-android测试,在这种情况下,我有一个使用adb shell的场景..因此,我在ruby中为同一个方法创建了如下方法:

def mock_barcode_scan(barcode = '676767')
    adb "shell am broadcast -a com.zz.zz.MockBarcodeReadEvent -e BARCODE #{barcode}"
  end

now when i try to access this method, NO action is performed .. and scenario fails for this step ... note: i am using windows 7 and executing this test using git bash.. 现在,当我尝试访问此方法时,不执行任何操作..并且此步骤的场景失败...注意:我正在使用Windows 7,并使用git bash执行此测试。

You can try use command system() example: irb 您可以尝试使用命令system()示例: irb

2.3.1 :001 > system("adb devices")

print: List of devices attached 打印: List of devices attached

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM