如何使用calabash-android中的ruby脚本在移动应用程序测试期间生成“电池电量不足”通知

时间:2022-11-18 19:59:40

I am trying to generate notifications(Battery,chargerconnect,headphone connect,memory card insertion etc.) with my customized ruby step-definitions in calabash-android during automation of mobile apps. Is there any way to interact with Android OS broadcasts with ruby script so that i can generate interrupts at any point of mob app testing.

我想在移动应用程序自动化期间使用calabash-android中的自定义ruby步骤定义生成通知(电池,充电器连接,耳机连接,存储卡插入等)。有没有办法与Android操作系统广播与ruby脚本交互,以便我可以在暴徒应用程序测试的任何点生成中断。

1 个解决方案

#1


0  

There are no built-in steps for this in Calabash. You should develop your own.

在Calabash没有内置的步骤。你应该发展自己的。


For instance, setting battery level for default Android Emulator (AVD) will look like:

例如,为默认Android模拟器(AVD)设置电池电量将如下所示:

Then /^I set battery level to (\d+) percent$/ do |battery_level|
  %x{"{ echo 'open localhost 5554'; sleep 1; echo 'power capacity #{battery_level}'; } | telnet 2>&1"}
end

#1


0  

There are no built-in steps for this in Calabash. You should develop your own.

在Calabash没有内置的步骤。你应该发展自己的。


For instance, setting battery level for default Android Emulator (AVD) will look like:

例如,为默认Android模拟器(AVD)设置电池电量将如下所示:

Then /^I set battery level to (\d+) percent$/ do |battery_level|
  %x{"{ echo 'open localhost 5554'; sleep 1; echo 'power capacity #{battery_level}'; } | telnet 2>&1"}
end