首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >停止重置用于测试的模拟器

停止重置用于测试的模拟器
EN

Stack Overflow用户
提问于 2018-02-06 18:11:20
回答 2查看 180关注 0票数 1

我在我的模拟器上运行Calabash-IOS。如果我在应用程序已经运行的情况下在终端中输入cucumber,它将关闭整个模拟器,并启动它的一个新实例,然后运行所有测试。它运行我所有的登录场景和大纲,只是为了在用户登录后测试一件事。

有没有办法禁用它,这样测试就可以从我打开视图的地方运行?

EN

回答 2

Stack Overflow用户

发布于 2018-02-06 21:58:52

来自Calabash::Cucumber::Launcher文档

在控制台中附加到当前启动器的

如果Calabash已经在运行,并且您想要附加到当前的启动器,请使用console_attach。当黄瓜场景失败,并且您想要查询应用程序的当前状态时,这很有用。

从理论上讲,这意味着您可以使用console_attach连接到正在运行的calabash实例。

票数 1
EN

Stack Overflow用户

发布于 2018-02-09 14:10:07

这是我在support文件夹中的配置:

01_launch.rb

代码语言:javascript
复制
require 'calabash-cucumber/launcher'

# You can find examples of more complicated launch hooks in these
# two repositories:
#
# https://github.com/calabash/ios-smoke-test-app/blob/master/CalSmokeApp/features/support/01_launch.rb
# https://github.com/calabash/ios-webview-test-app/blob/master/CalWebViewApp/features/support/01_launch.rb

module Calabash::Launcher
  @@launcher = nil

  def self.launcher
    @@launcher ||= Calabash::Cucumber::Launcher.new
  end

  def self.launcher=(launcher)
    @@launcher = launcher
  end
end


$testServerRunning = false


Before do |scenario|
  scenario_tags = scenario.source_tag_names
  if !$testServerRunning || scenario_tags.include?('@restart')
    if $testServerRunning
      shutdown_test_server
    end

    start_test_server_in_background

    $testServerRunning = true
  end
end

After do |scenario|
  Cucumber.wants_to_quit = false
  if scenario.failed?
    screenshot_embed
  end
end

env.rb

代码语言:javascript
复制
require "calabash-cucumber"

# Cucumber -d must pass, but support/env.rb is not eval'd on dry runs.
# We must detect that the user wants to use pre-defined steps.
dir = File.expand_path(File.dirname(__FILE__))
env = File.join(dir, "env.rb")

contents = File.read(env).force_encoding("UTF-8")

contents.split($-0).each do |line|

  # Skip comments.
  next if line.chars[0] == "#"

  if line[/calabash-cucumber\/cucumber/, 0]
    require "calabash-cucumber/calabash_steps"
    break
  end
end
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48640425

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档