使用Jenkins对Ruby on Rails进行持续集成测试

red*_*ddy 14 ruby-on-rails

有没有人知道用Jenkins与Ruby on Rails进行持续集成测试的方法?

我跟随Rspec在ROR应用程序中编写测试用例.

我需要将测试过程与jenkins CI集成.

如果你能提供任何指示,我真的很感激.

bre*_*dan 17

由于Jenkins可以在命令行上运行任何东西,因此重要的部分是允许Jenkins解释测试输出.

基本上你需要的是这个宝石:

https://github.com/nicksieger/ci_reporter

CI Reporter gem将输出Test :: Unit和RSpec测试结果作为Jenkins可以解释的兼容JUnit的XML文件.我相信这是整合的关键.


Ari*_*jan 15

是的你可以.设置Jenkins,确保在您的系统上安装了Ruby(包括RVM,bundler,mysql以及您需要的任何其他内容).

然后使用这些构建命令创建一个作业;

#!/bin/bash
source ~/.profile
rvm use --create ruby-1.8.7@my_app
rvm --force gemset empty
gem install bundler --no-rdoc --no-ri
bundle install
cp config/database.yml.jenkins config/database.yml

bundle exec rake db:create:all
bundle exec rake db:migrate
bundle exec rake db:test:prepare
Run Code Online (Sandbox Code Playgroud)

对于黄瓜

#!/bin/bash
source ~/.profile
rvm use ruby-1.8.7@my_app

bundle exec rake cucumber
Run Code Online (Sandbox Code Playgroud)

对于RSpec

#!/bin/bash
source ~/.profile
rvm use ruby-1.8.7@my_app

bundle exec rake spec
Run Code Online (Sandbox Code Playgroud)