android - Windows 上的 Calabash-Android

标签 android windows cucumber calabash gherkin

我不确定最近是否已经讨论过这个话题,但我自己在网上搜索时感到非常沮丧,尝试了几个指南和修复程序。我做了很多事情,我无法真正说出我已经做了什么 :(

所以我尝试在 Windows 10 64 位上运行 Calabash-Android,我按照 https://github.com/calabash/calabash-android 上的步骤安装了 ruby​​、Ant 和 DevKit。当我现在尝试运行测试时:

calabash-android run app-release.apk

我得到这样的输出:

*** WARNING: You must use ANSICON 1.31 or higher (https://github.com/adoxa/ansicon/) to get coloured output on Windows
WARNING: cannot load such file -- gherkin_lexer_en
Couldn't load gherkin_lexer_en
The $LOAD_PATH was:
lib
C:/Ruby21/lib/ruby/gems/2.1.0/gems/cucumber-1.3.20/bin/../lib
C:/Ruby21/lib/ruby/gems/2.1.0/gems/builder-3.2.2/lib
C:/Ruby21/lib/ruby/gems/2.1.0/gems/diff-lcs-1.2.5/lib
C:/Ruby21/lib/ruby/gems/2.1.0/gems/multi_json-1.11.2/lib
C:/Ruby21/lib/ruby/gems/2.1.0/gems/gherkin-2.12.2-x86-mingw32/lib
C:/Ruby21/lib/ruby/gems/2.1.0/gems/multi_test-0.1.2/lib
C:/Ruby21/lib/ruby/gems/2.1.0/gems/cucumber-1.3.20/lib
C:/Ruby21/lib/ruby/gems/2.1.0/gems/retriable-1.4.1/lib
C:/Ruby21/lib/ruby/gems/2.1.0/gems/slowhandcuke-0.0.3/lib
C:/Ruby21/lib/ruby/gems/2.1.0/gems/rubyzip-1.1.7/lib
C:/Ruby21/lib/ruby/gems/2.1.0/gems/awesome_print-1.6.1/lib
C:/Ruby21/lib/ruby/gems/2.1.0/gems/httpclient-2.7.0.1/lib
C:/Ruby21/lib/ruby/gems/2.1.0/gems/escape-0.0.4/lib
C:/Ruby21/lib/ruby/gems/2.1.0/gems/calabash-android-0.5.14/lib
C:/Ruby21/lib/ruby/site_ruby/2.1.0
C:/Ruby21/lib/ruby/site_ruby/2.1.0/i386-msvcrt
C:/Ruby21/lib/ruby/site_ruby
C:/Ruby21/lib/ruby/vendor_ruby/2.1.0
C:/Ruby21/lib/ruby/vendor_ruby/2.1.0/i386-msvcrt
C:/Ruby21/lib/ruby/vendor_ruby
C:/Ruby21/lib/ruby/2.1.0
C:/Ruby21/lib/ruby/2.1.0/i386-mingw32. Reverting to Ruby lexer.
No lexer was found for en (cannot load such file -- gherkin/lexer/en). Supported languages are listed in gherkin/i18n.json. (Gherkin::I18n::LexerNotFound)
C:/Ruby21/lib/ruby/gems/2.1.0/gems/gherkin-2.12.2-x86-mingw32/lib/gherkin/i18n.rb:108:in `rescue in lexer'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/gherkin-2.12.2-x86-mingw32/lib/gherkin/i18n.rb:97:in `lexer'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/gherkin-2.12.2-x86-mingw32/lib/gherkin/parser/parser.rb:139:in `transition_table'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/gherkin-2.12.2-x86-mingw32/lib/gherkin/parser/parser.rb:128:in `build_transition_map'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/gherkin-2.12.2-x86-mingw32/lib/gherkin/parser/parser.rb:124:in `transition_map'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/gherkin-2.12.2-x86-mingw32/lib/gherkin/parser/parser.rb:91:in `initialize'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/gherkin-2.12.2-x86-mingw32/lib/gherkin/parser/parser.rb:68:in `new'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/gherkin-2.12.2-x86-mingw32/lib/gherkin/parser/parser.rb:68:in `push_machine'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/gherkin-2.12.2-x86-mingw32/lib/gherkin/parser/parser.rb:31:in `parse'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/cucumber-1.3.20/lib/cucumber/feature_file.rb:37:in `parse'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/cucumber-1.3.20/lib/cucumber/runtime/features_loader.rb:28:in `block in load'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/cucumber-1.3.20/lib/cucumber/runtime/features_loader.rb:26:in `each'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/cucumber-1.3.20/lib/cucumber/runtime/features_loader.rb:26:in `load'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/cucumber-1.3.20/lib/cucumber/runtime/features_loader.rb:14:in `features'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/cucumber-1.3.20/lib/cucumber/runtime.rb:179:in `features'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/cucumber-1.3.20/lib/cucumber/runtime.rb:49:in `run!'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/cucumber-1.3.20/lib/cucumber/cli/main.rb:47:in `execute!'
C:/Ruby21/lib/ruby/gems/2.1.0/gems/cucumber-1.3.20/bin/cucumber:13:in `<top (required)>'
C:/Ruby21/bin/cucumber:23:in `load'
C:/Ruby21/bin/cucumber:23:in `<main>'

所以我用谷歌搜索了第一个错误“警告无法加载此类文件[...],找到了多个结果,尝试了这个 https://github.com/cucumber/gherkin/issues/320,尝试过:

gem install gherkin --platform=ruby

得到这样的输出:

Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing gherkin:
        ERROR: Failed to build gem native extension.

    C:/Ruby21/bin/ruby.exe extconf.rb
checking for main() in -lc... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=C:/Ruby21/bin/ruby
        --with-gherkin_lexer_ar-dir
        --without-gherkin_lexer_ar-dir
        --with-gherkin_lexer_ar-include
        --without-gherkin_lexer_ar-include=${gherkin_lexer_ar-dir}/include
        --with-gherkin_lexer_ar-lib
        --without-gherkin_lexer_ar-lib=${gherkin_lexer_ar-dir}/lib
        --with-clib
        --without-clib
C:/Ruby21/lib/ruby/2.1.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
        from C:/Ruby21/lib/ruby/2.1.0/mkmf.rb:541:in `try_link0'
        from C:/Ruby21/lib/ruby/2.1.0/mkmf.rb:556:in `try_link'
        from C:/Ruby21/lib/ruby/2.1.0/mkmf.rb:736:in `try_func'
        from C:/Ruby21/lib/ruby/2.1.0/mkmf.rb:967:in `block in have_library'
        from C:/Ruby21/lib/ruby/2.1.0/mkmf.rb:912:in `block in checking_for'
        from C:/Ruby21/lib/ruby/2.1.0/mkmf.rb:351:in `block (2 levels) in postpone'
        from C:/Ruby21/lib/ruby/2.1.0/mkmf.rb:321:in `open'
        from C:/Ruby21/lib/ruby/2.1.0/mkmf.rb:351:in `block in postpone'
        from C:/Ruby21/lib/ruby/2.1.0/mkmf.rb:321:in `open'
        from C:/Ruby21/lib/ruby/2.1.0/mkmf.rb:347:in `postpone'
        from C:/Ruby21/lib/ruby/2.1.0/mkmf.rb:911:in `checking_for'
        from C:/Ruby21/lib/ruby/2.1.0/mkmf.rb:962:in `have_library'
        from extconf.rb:5:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in C:/Ruby21/lib/ruby/gems/2.1.0/gems/gherkin-2.12.2 for inspection.
Results logged to C:/Ruby21/lib/ruby/gems/2.1.0/extensions/x86-mingw32/2.1.0/gherkin-2.12.2/gem_make.out

我很确定我做了几个修复,但对我来说没有任何效果,也许你们可以帮助我?真的需要使这项工作。也许我只是错过了一些小细节?

问候 卡帕斯科

最佳答案

我们正在为 Windows 开发一个实验性的 Calabash 沙盒,它可能会有所帮助。

在 Admin Powershell 中,运行:

set-executionpolicy unrestricted

然后

(New-Object System.Net.WebClient).DownloadString("https://raw.githubusercontent.com/calabash/install/master/install-windows.ps1") | powershell -command -

然后打开命令提示符(不是 powershell)并运行

calabash-sandbox

在该沙箱内,所有的 calabash-android 命令都应该起作用,并且您将拥有一个预配置的 ruby​​ 环境(它不会影响系统的其余 ruby​​ 配置)。

要退出沙箱,只需键入 exit

当你完成安装后,记得在 powershell 中运行它:

set-executionpolicy restricted

只是为了安全:)

关于android - Windows 上的 Calabash-Android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33648787/

相关文章:

如果禁用 SSL v3 和 TLS v1.0,Android 4.x 无法连接到 Worklight Server

android - 如何正确取消实时多人比赛?

android - 在本地写入 android wear

c++ - 平台之间的类型不同

windows - 当 flAllocationType = MEM_RESERVE 时,为什么 VirtualAlloc() 需要 flProtect = PAGE_NOACCESS?

ruby - 如何在 Cucumber 中模拟 TCP 连接

java - 在线程外使用 String

PHP FFmpeg 无法在 windowsxp 和实时网站上运行,在 ubuntu 中运行相同的代码

javascript - 是否可以使 cucumber.js 步骤定义超时

java - 如何比较 Java 中预期对象属性是动态的两个对象