1

我是 Ruby/Calabash 的新手,并设法为 ios 设置了一个专用的 Calabash 自动化框架,该框架具有页面对象模型模式并成功运行。

我也想为 android 扩展相同的框架。我在 features 文件夹中为 ios 和 android 创建了一个专用文件夹,并考虑将它们各自的页面对象放在这些文件夹中。

但是当我运行 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>'
4

3 回答 3

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 跨平台教程Github 页面上的相同内容

于 2015-04-11T05:11:47.447 回答
0

有类似的问题,通过将排除选项“--exclude ios”添加到config/cucumber.yml文件中的 android 配置文件(以及 ios 的“--exclude android”)来解决

---
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

似乎是黄瓜错误,因为根据黄瓜文档 -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
于 2016-09-02T10:51:55.627 回答
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
于 2017-05-03T21:45:13.330 回答