【问题标题】:Calabash Error - superclass mismatch for class AuthenticationPageCalabash 错误 - 类 AuthenticationPage 的超类不匹配
【发布时间】:2015-04-10 10:55:20
【问题描述】:

我是 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>'

【问题讨论】:

  • 如果您需要更多信息,请告诉我:(

标签: xamarin ios-ui-automation calabash calabash-ios calabash-android


【解决方案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 tutorialGithub page for same

【讨论】:

  • 感谢您的回复。但是,我正在使用 .yml 文件并配置了我的 .yml ,如上所述。我的问题是我在 ios 和 android 文件夹中为页面对象创建了独立的文件夹。但是如果 ruby​​ 在两个不同的目录中发现相同的类,则会出现编译错误,我不知道如何解决这个问题。这清楚吗,如果没有请告诉我:(
  • 您能否添加一些关于您的文件夹结构的文字?每个平台应该有不同的文件夹。像 /features/android/pages/ 和 /features/ios/pages/。您如何定义两个平台上的类?你在使用 ABBase 和 IBase 吗?
【解决方案2】:

有类似的问题,通过在 config/cucumber.yml 文件中的 android 配置文件中添加排除选项“--exclude ios”来解决(分别为 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

【讨论】:

    【解决方案3】:

    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
    

    【讨论】:

      猜你喜欢
      • 2021-12-29
      • 1970-01-01
      • 2022-11-03
      • 2022-01-18
      • 2018-03-10
      • 1970-01-01
      • 1970-01-01
      • 2013-01-16
      相关资源
      最近更新 更多