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掛鉤與一個或多個標籤相關聯來實現。

相關問題