我是Ruby / Calabash的新手,并设法为ios设置了一个专用的calabash自动化框架,它具有页面对象模型模式并且运行成功。
我也希望为Android扩展相同的框架。我为ios和android inside features文件夹创建了一个专用文件夹,并想到在这些文件夹中有各自的页面对象。
但是当我运行calabash-android时,calabash发现ios文件夹中存在类似的页面类,并开始抛出错误消息。我想对ios和android页面遵循相同的命名约定,而不会有这个名字冲突。可能吗?
superclass mismatch for class AuthenticationPage (TypeError)
/Users/MACUSER/Documents/Automation/features/ios/pages/authentication_page. rb:5:in `<top (required)>'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/rb_support/rb_language.rb:95:in `load'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/rb_support/rb_language.rb:95:in `load_code_file'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/runtime/support_code.rb:180:in `load_file'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/runtime/support_code.rb:83:in `block in load_files!'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/runtime/support_code.rb:82:in `each'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/runtime/support_code.rb:82:in `load_files!'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/runtime.rb:184:in `load_step_definitions'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/runtime.rb:42:in `run!'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/lib/cucumber/cli/main.rb:47:in `execute!'
/Library/Ruby/Gems/2.0.0/gems/cucumber-1.3.18/bin/cucumber:13:in `<top (required)>'
/usr/bin/cucumber:23:in `load'
/usr/bin/cucumber:23:in `<main>'
答案 0 :(得分:1)
根据您对问题的描述,目前尚不清楚问题所在。 我认为如果您添加有关文件夹结构和文件的更多详细信息会有所帮助。
但是你没有提到个人资料,因为我怀疑你没有使用.yml文件。
执行测试时,您应该定义正在运行的配置文件,其中一个用于iOS,另一个用于Android。对于每个配置文件,您将定义要包含的文件夹。
喜欢这个
android: PLATFORM=android RESET_BETWEEN_SCENARIOS=1 -r features/support -r features/android/support -r features/android/helpers -r features/step_definitions -r features/android/pages/
然后当您执行测试时,您定义了什么配置文件
calabash-android run path_to.apk -p android features/login.feature
如果您还没有,请查看Xamarin cross-platform tutorial或Github page for same
答案 1 :(得分:0)
有类似的问题,通过添加排除选项来解决&#34; - 排除ios&#34;到 config / cucumber.yml 文件中的android配置文件(&#34; - 分别排除android&#34; for ios)
---
android: PLATFORM=android --exclude ios -r features/support -r features/android -r features/step_definitions -r features/android/pages
ios: PLATFORM=ios APP_BUNDLE_PATH=path_to_your.app --exclude android -r features/support -r features/ios/support -r features/ios/helpers -r features/step_definitions -r features/ios/pages
似乎是黄瓜bug,因为根据黄瓜docs -r开关应该阻止加载除明确指定的文件外的所有文件
-r, --require LIBRARY|DIR Require files before executing the features. If this
option is not specified, all *.rb files that are
siblings or below the features will be loaded auto-
matically. Automatic loading is disabled when this
option is specified, and all loading becomes explicit.
Files under directories named "support" are always
loaded first.
...
-e, --exclude PATTERN Don't run feature files or require ruby files matching PATTERN
答案 2 :(得分:0)
Xamarin说你应该在命令--profile ios --config=config/cucumber.yml
中提供配置文件和配置。见:
test-cloud submit prebuilt/Moda-cal.ipa 93dbwrmwrb0d65099640f23 --devices 99dwdhw846 --series "ip7" --locale "en_US" --app-name "Moda" --user gunesmes@gmail.com --profile ios --config=config/cucumber.yml
test-cloud submit prebuilt/Moda.apk 93dbwrmwrb06sfu440f23 --devices 9933nb846 --series "nex" --locale "en_US" --app-name "Moda" --user gunesmes@gmail.com --profile android --config=config/cucumber.yml