【问题标题】:Calabash - do not reinstall app on startupCalabash - 不要在启动时重新安装应用程序
【发布时间】:2015-10-13 10:50:59
【问题描述】:

我的应用在第一次运行时用户必须进行身份验证。

我有一个带有不同标记场景的功能。现在我只需要运行几个场景,但每次运行以下命令时

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(......)

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

【问题讨论】:

    标签: android automated-tests android-testing calabash calabash-android


    【解决方案1】:

    我认为您需要更新您的 app_installation_hooks 并添加标记的 Before 挂钩。

    Calabash 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
    

    【讨论】:

      【解决方案2】:

      Cucumber 提供了许多 hooks,它们允许我们在 Cucumber 测试周期的各个点运行块。

      我认为您需要的是 标记的钩子

      有时您可能希望某个挂钩仅在某些情况下运行。这可以通过将 Before、After、Around 或 AfterStep 挂钩与一个或多个标签相关联来实现。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-10-09
        • 1970-01-01
        • 2021-01-04
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多