设置 rake 任务来运行特定的 Cucumber 场景
我正在尝试设置一个 rake 任务来运行具有特定标签(@server)的任何黄瓜场景。 我在项目目录的根目录中有一个带有以下代码的 rakefile:
require 'cucumber/rake/task'
desc "Get SQL response and store it in a file"
Cucumber::Rake::Task.new(:server, 'Execute SQL (@server only)') do |t|
t.cucumber_opts = [ '--tags', '@server' ]
end
task :default => :server
在项目根目录中还有一个用于默认配置文件的 cucumber.yml 文件,
default: --profile server_cache
server_cache: --format pretty --tags @server
我尝试在项目文件夹中的命令提示符上运行“jruby -S rake”我收到此错误:
“‘jruby.bat.exe’未被识别为内部或外部命令、可操作程序或批处理文件”
我是否试图以错误的方式运行该任务?
我在 Windows XP 上使用 jruby 1.5.6,版本 1.8。
预先感谢您的任何帮助!
I'm trying to set up a rake task to run any cucumber scenario with a certain tag(@server).
I have a rakefile in the root of the project directory with this code:
require 'cucumber/rake/task'
desc "Get SQL response and store it in a file"
Cucumber::Rake::Task.new(:server, 'Execute SQL (@server only)') do |t|
t.cucumber_opts = [ '--tags', '@server' ]
end
task :default => :server
With a cucumber.yml file for default profile in the root of the project as well
default: --profile server_cache
server_cache: --format pretty --tags @server
I try running "jruby -S rake" on the command prompt while in my project folder and I get this error:
"'jruby.bat.exe' is not recognized as an internal or external command, operable program or batch file"
Am I trying to run the task in a wrong way?
I'm using jruby 1.5.6, version 1.8, on windows xp.
Thanks in advance for any help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我本来想将此作为评论发布,但你的问题与 rake 无关,而与 gem 安装有关
我很好奇,你在使用 RubyMine 吗?我以前在使用 RubyMine 的安装程序为 jruby 安装 gems 时遇到过这个问题。无论出于何种原因,它都会在安装 gem 期间破坏批处理文件。
例如,您的 rake.bat 文件应如下所示:
如果不是,则可能已由您的 gem 安装过程更新。
您正在正确执行命令,但某些东西已经修改了 rake.bat (或 cucumber.bat,也请检查它)以包含“jruby.bat.exe”的执行,而它应该只调用 jruby.exe 供参考,我的 cucumber.bat 看起来像这样:
I would have posted this as a comment, but your problem has nothing to do with rake, and everything to do with gem installation
I'm curious, are you using RubyMine? I've had this problem before when I installed gems for jruby using RubyMine's installer. For whatever reason, it munges the batch files during installation of gems.
For example, your rake.bat file should look something like this:
If it doesn't, it's probably been updated by your gem install process.
You're executing the command correctly, but something has munged the rake.bat (or cucumber.bat, check it as well) to include an execution of 'jruby.bat.exe' when it should just call jruby.exe For reference, my cucumber.bat looks like this: