http://devblog.snap-interactive.com/post/45933948225/mobile-automation-of-ios-nativeに記載されている手順に従って、rspec (キュウリではない) を使用して Calabash-iOS の統合をセットアップしようとしています。 -apps-with-calabash-ios#.Ue6PORz5BhF です が、続行できません。私が従った手順とデバッグエラーも詳細にリストしました。何がうまくいかないのか、いくつかの光を共有してください..私はルビーとひょうたんも初めてです。
手順: XCodeproject を作成し、https://github.com/calabash/calabash-iosに記載されている手順に従ってプロジェクトを構成しました。ターミナル cd でプロジェクト ディレクトリに移動し、rspec gem をインストールし、rspec –init を実行して spec_helper を作成しました。
ルビーマインを使用しています。
次のように存在するツリー構造:
テストプロジェクト
- ひょうたん.framework
- 特徴
- step_definitions
- サポート
- 01_launch.rb – このファイルを lib ディレクトリに移動し、spec_helper.rb で参照した launch.rb に名前を変更しました
- ..その他のファイル
- ライブラリ
- launch.rb
- MySpec.rb
- スペック
- MySpec_spec.rb
- spec_helper.rb
- 他のプロジェクト フォルダ…..
ここで見逃している rspec を使用しているときに従うべき特定の形式はありますか? (きゅうりの機能フォルダー、step_definitions などにあるように..)
ファイルの内容を投稿しています:
launch.rb
########################################
# #
# Important Note #
# #
# When running calabash-ios tests at #
# www.xamarin.com/test-cloud #
# this file will be overwritten by #
# a file which automates #
# app launch on devices. #
# #
# Don't rely on this file being #
# present when running at #
# Xamarin Test Cloud #
# #
########################################
require 'calabash-cucumber/launcher'
APP_BUNDLE_PATH = "~/Library/Developer/Xcode/DerivedData/MyApp-dftlalczpovmeddcybgllunvwpoe/Build/Products/Release-iphonesimulator/MyApp.app"
Before do |scenario|
@calabash_launcher = Calabash::Cucumber::Launcher.new
unless @calabash_launcher.calabash_no_launch?
@calabash_launcher.relaunch
@calabash_launcher.calabash_notify(self)
end
end
After do |scenario|
unless @calabash_launcher.calabash_no_stop?
calabash_exit
@calabash_launcher.stop
end
end
at_exit do
launcher = Calabash::Cucumber::Launcher.new
if launcher.simulator_target?
Calabash::Cucumber::SimulatorHelper.stop unless launcher.calabash_no_stop?
end
end
> このように APP_BUNDLE_PATH を追加するのは正しいですか?
> アプリケーションのソース コードがある場合、または .app がある場合にのみ、ここに APP_BUNDLE_PATH を追加する必要がありますか?"
Debugging launch.rbで、次のエラーが表示されます。誰かがこれを解決するのを手伝ってくれます:
/Users/qateam/.rbenv/versions/2.0.0-p247/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/qateam/Desktop/library_project/TestProject/lib/launch.rb
/Users/qateam/Desktop/library_project/TestProject/lib/launch.rb:30:in `<top (required)>': undefined method `Before' for main:Object (NoMethodError)
from -e:1:in `load'
from -e:1:in `<main>'
Process finished with exit code 1
spec_helper.rb
require_relative '../lib/launch'
require ‘rspec’
require ‘rubygems’
require 'calabash-cucumber/core'
require 'calabash-cucumber/tests_helpers'
require 'calabash-cucumber/keyboard_helpers'
require 'calabash-cucumber/wait_helpers'
require 'calabash-cucumber/operations'
require 'calabash-cucumber/version'
require 'calabash-cucumber/location'
require 'calabash-cucumber/ibase'
include Calabash::Cucumber::Core
include Calabash::Cucumber::WaitHelpers
include Calabash::Cucumber::TestsHelpers
include Calabash::Cucumber::Operations
# This file was generated by the `rspec --init` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# Require this file using `require "spec_helper"` to ensure that it is only
# loaded once.
#
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
config.treat_symbols_as_metadata_keys_with_true_values = true
config.run_all_when_everything_filtered = true
config.filter_run :focus
# Run specs in random order to surface order dependencies. If you find an
# order dependency and want to debug it, you can fix the order by providing
# the seed, which is printed after each run.
# --seed 1234
config.order = 'random'
end
ご注意ください:
「require 'rspec'」行に「No such file to load」とあるのはなぜですか? プロジェクトディレクトリにrspec gemをインストールしました
spec_helper.rb をデバッグすると、次のエラーが表示されます。
/Users/qateam/.rbenv/versions/2.0.0-p247/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/qateam/Desktop/library_project/TestProject/spec/spec_helper.rb
/Users/qateam/Desktop/library_project/TestProject/lib/launch.rb:30:in `<top (required)>': undefined method `Before' for main:Object (NoMethodError)
from /Users/qateam/Desktop/library_project/TestProject/spec/spec_helper.rb:1:in `require_relative'
from /Users/qateam/Desktop/library_project/TestProject/spec/spec_helper.rb:1:in `<top (required)>'
from -e:1:in `load'
from -e:1:in `<main>'
Process finished with exit code 1
何がうまくいかないのかを教えてください。
MySpec_spec.rb
require ‘spec_helper’
.
.
.
.
ターミナルで「rspec spec」を実行すると、次のようになります。
/Users/qateam/Desktop/library_project/TestProject/spec/launch.rb:17:in <top (required)>': undefined method
before' for main:Object (NoMethodError) from /Users/qateam/Desktop/library_project/TestProject/spec/spec_helper.rb:1:in require_relative'
from /Users/qateam/Desktop/library_project/TestProject/spec/spec_helper.rb:1:in
' from /Users/qateam/.rbenv/versions/2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:51:in require'
from /Users/qateam/.rbenv/versions/2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:51:in
require' from /Users/qateam/Desktop/library_project /TestProject/spec/PlayWithShopwise_spec.rb:1:in <top (required)>'
from /Users/qateam/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rspec-core-2.14.4/lib/rspec/core/configuration.rb:896:in
load' from /Users/qateam/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rspec-core-2.14.4 /lib/rspec/core/configuration.rb:896:in block in load_spec_files'
from /Users/qateam/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rspec-core-2.14.4/lib/rspec/core/configuration.rb:896:in
each' from /Users/qateam/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rspec-core-2.14 .4/lib/rspec/core/configuration.rb:896:inload_spec_files'
from /Users/qateam/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rspec-core-2.14.4/lib/rspec/core/command_line.rb:22:in
/Users/qateam/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rspec-core-2.14.4/lib/rspec/core/runner.rb:80 から実行:in run'
from /Users/qateam/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rspec-core-2.14.4/lib/rspec/core/runner.rb:17:in
block in autorun'
これに関するすべての入力に感謝します..
calabash-rspec の実際の例、またはドキュメント/チュートリアルがある場合は、共有してください。
ありがとう、