0

我的应用程序在第一次运行时用户必须进行身份验证。葫芦 - 不要在启动时重新安装应用程序

我有不同的标记方案的功能。现在我只是需要运行一些情景,但我每次运行下面的命令

calabash-android run /path/to/apk features/my.feature --tags @Alert 

我的应用程序被重新安装这将导致测试失败对我的@Alert场景。我如何告诉葫芦不要重新安装应用程序?

从谷歌上搜索周围,我发现this它说:

Go to app_installation_hooks.rb file under support folder and comment out following 3 lines: 

uninstall_apps 
install_app(......) 
install_app(......) 

,但我正在寻找一个命令或更优雅的方式做我想做什么。

回答

1

我认为你需要更新你的app_installation_hooks并添加一个标记的Before钩子。

葫芦iOS烟雾测试01_launch.rb(是的,它是一个iOS的例子,但原理是相同的)有我的意思的例子。

Before('@reset_app_btw_scenarios') do 
    if xamarin_test_cloud? 
    ENV['RESET_BETWEEN_SCENARIOS'] = '1' 
    elsif LaunchControl.target_is_simulator? 
    target = LaunchControl.target 
    simulator = RunLoop::Device.device_with_identifier(target) 
    app = RunLoop::App.new(ENV['APP']) 
    core_sim = RunLoop::CoreSimulator.new(simulator, app) 
    core_sim.reset_app_sandbox 
    else 
    LaunchControl.install_on_physical_device 
    end 
end 
0

黄瓜提供了许多hooks这允许我们在黄瓜测试周期的各个点运行块。

我想你需要什么标签钩

有时你可能需要一定的钩子只为某些情况下运行。这可以通过将Before,After,Around或AfterStep挂钩与一个或多个标签相关联来实现。

相关问题