ci-reporter / ci_reporter Goto Github PK
View Code? Open in Web Editor NEWCI::Reporter is an add-on to popular test frameworks that allows you to generate XML reports
License: MIT License
CI::Reporter is an add-on to popular test frameworks that allows you to generate XML reports
License: MIT License
In the latest release the following files are missing:
acceptance/spinach/Gemfile
acceptance/spinach/Gemfile.lock
acceptance/spinach/features/spinach_example.feature
acceptance/spinach/features/steps/example_steps.rb
lib/ci/reporter/rake/spinach.rb
lib/ci/reporter/rake/spinach_loader.rb
lib/ci/reporter/spinach.rb
I considered to open a pull request for this small issue but changing the gemspec and version files in a gem is something personal. Hope this helps. thank you for working on the gem.
With the JUnit reporter, if the tests are killed externally (e.g. if they take too long to run), one of the XML files will have length 0 and Jenkins will fail to parse it. This then shows up as a test failure on Jenkins.
With CI::Reporter, if the tests are killed externally, they just exit and no XML file is written at all. This shows up as a successful build.
Granted, the return code is non-zero, but it seems like a hack for me to create a zero-length XML file on the event of a non-zero return code, just to trick Jenkins.
Hello,
ci_reporter seems to have some problems running multiple rake tasks.
For example, I have one rake task that runs test_unit tests and one rake task that runs minitest tasks. These tests use different helpers, so they must be executed in different rake tasks.
If I use the following line:
rake -f <ci_reporter_rakefile> ci:setup:testunit test:fast test:rails
Only the tests in test:rails
are executed.
If I use two lines for this:
rake -f <ci_reporter_rakefile> ci:setup:testunit test:rails
rake -f <ci_reporter_rakefile> ci:setup:minitest test:fast
All tests are executed, but the second task deletes the first task output files, so jenkins will only publish junit test reports for test:fast
.
Is there any way to run more than one test rake task and get the junit output of all of them? Is there any workaround for this problem? If not, how can I implement it?
Thanks
Adding a require for 'time' fixed it
This only happens when RCov is running. Works 100% without it.
Works fine with ci_reporter 1.6.2. I've done some digging but can't find the cause myself. Let me know if there's any more information I can provide on this.
/opt/ruby/lib/ruby/gems/1.8/gems/ci_reporter-1.6.3/lib/ci/reporter/rake/../../../ci/reporter/rspec.rb:67:in `initialize': wrong number of arguments (2 for 1) (ArgumentError)
from /opt/ruby/lib/ruby/gems/1.8/gems/ci_reporter-1.6.3/lib/ci/reporter/rake/../../../ci/reporter/rspec.rb:67:in `initialize'
from /opt/ruby/lib/ruby/gems/1.8/gems/rspec-1.3.1/lib/spec/runner/options.rb:248:in `new'
from /opt/ruby/lib/ruby/gems/1.8/gems/rspec-1.3.1/lib/spec/runner/options.rb:248:in `load_formatters'
from /opt/ruby/lib/ruby/gems/1.8/gems/rspec-1.3.1/lib/spec/runner/options.rb:240:in `map'
from /opt/ruby/lib/ruby/gems/1.8/gems/rspec-1.3.1/lib/spec/runner/options.rb:240:in `load_formatters'
from /opt/ruby/lib/ruby/gems/1.8/gems/rspec-1.3.1/lib/spec/runner/options.rb:236:in `formatters'
from /opt/ruby/lib/ruby/gems/1.8/gems/rspec-1.3.1/lib/spec/runner/reporter.rb:111:in `formatters'
from /opt/ruby/lib/ruby/gems/1.8/gems/rspec-1.3.1/lib/spec/runner/reporter.rb:50:in `start'
from /opt/ruby/lib/ruby/gems/1.8/gems/rspec-1.3.1/lib/spec/runner/example_group_runner.rb:32:in `prepare'
from /opt/ruby/lib/ruby/gems/1.8/gems/rspec-1.3.1/lib/spec/runner/example_group_runner.rb:20:in `run'
from /opt/ruby/lib/ruby/gems/1.8/gems/rspec-1.3.1/lib/spec/runner/options.rb:153:in `run_examples'
from /opt/ruby/lib/ruby/gems/1.8/gems/rspec-1.3.1/lib/spec/runner.rb:61:in `run'
from /opt/ruby/lib/ruby/gems/1.8/gems/rspec-1.3.1/lib/spec/runner.rb:45:in `autorun'
/Users/heinleng/.rvm/gems/ruby-1.9.3-p0/gems/ci_reporter-1.7.0/lib/ci/reporter/rspec.rb:203:in write_report': undefined method
finish' for nil:NilClass (NoMethodError)
https://github.com/nicksieger/ci_reporter/blob/master/lib/ci/reporter/rspec.rb#L206 This is the line that's failing. @suite is nil, and I have no idea how to fix it.
Ruby => ruby-1.9.3-p0
Rspec => rspec-rails (2.8.1)
This is my Rakefile:
require File.expand_path('../config/application', __FILE__)
require 'rspec/core/rake_task'
require 'ci/reporter/rake/rspec'
RSpec::Core::RakeTask.new(:all => ["ci:setup:rspec"]) do |t|
t.pattern = 'spec/**/*'
end
TestingCi::Application.load_tasks
Getting a deprecation warning:
*****************************************************************
DEPRECATION WARNING: you are using a deprecated constant that will
be removed from a future version of RSpec.
* Spec is deprecated.
* RSpec is the new top-level module in RSpec-2
And then an error:
/var/lib/hudson/.rvm/gems/ruby-1.9.2-preview3/gems/ci_reporter-1.6.2/lib/ci/reporter/rspec.rb:42:in `<module:Reporter>': uninitialized constant RSpec::Runner (NameError)
from /var/lib/hudson/.rvm/gems/ruby-1.9.2-preview3/gems/ci_reporter-1.6.2/lib/ci/reporter/rspec.rb:21:in `<module:CI>'
from /var/lib/hudson/.rvm/gems/ruby-1.9.2-preview3/gems/ci_reporter-1.6.2/lib/ci/reporter/rspec.rb:20:in `<top (required)>'
Version 1.6.3:
I have a unit-test that is failing only with ci_reporter, because $stdout is changing "mid-stream", and the test is expecting it to be the same value throughout the life of the test.
Digging through the code, I found out I could turn off capture with CI_CAPTURE=off, however disable capture generates an exception:
/home/dcorbin/.gem/ruby/1.8/gems/builder-2.1.2/lib/builder/xmlbase.rb:115:in _escape': undefined method
to_xs' for nil:NilClass (NoMethodError)
from /home/dcorbin/.gem/ruby/1.8/gems/builder-2.1.2/lib/builder/xmlbase.rb:81:in text!' from /home/dcorbin/.gem/ruby/1.8/gems/ci_reporter-1.6.3/lib/ci/reporter/test_suite.rb:89 from /home/dcorbin/.gem/ruby/1.8/gems/builder-2.1.2/lib/builder/xmlbase.rb:134:in
call'
from /home/dcorbin/.gem/ruby/1.8/gems/builder-2.1.2/lib/builder/xmlbase.rb:134:in _nested_structures' from /home/dcorbin/.gem/ruby/1.8/gems/builder-2.1.2/lib/builder/xmlbase.rb:58:in
method_missing'
from /home/dcorbin/.gem/ruby/1.8/gems/builder-2.1.2/lib/builder/xmlbase.rb:31:in tag!' from /home/dcorbin/.gem/ruby/1.8/gems/ci_reporter-1.6.3/lib/ci/reporter/test_suite.rb:88 from /home/dcorbin/.gem/ruby/1.8/gems/builder-2.1.2/lib/builder/xmlbase.rb:134:in
call'
from /home/dcorbin/.gem/ruby/1.8/gems/builder-2.1.2/lib/builder/xmlbase.rb:134:in _nested_structures' from /home/dcorbin/.gem/ruby/1.8/gems/builder-2.1.2/lib/builder/xmlbase.rb:58:in
method_missing'
from /home/dcorbin/.gem/ruby/1.8/gems/ci_reporter-1.6.3/lib/ci/reporter/test_suite.rb:84:in to_xml' from /home/dcorbin/.gem/ruby/1.8/gems/ci_reporter-1.6.3/lib/ci/reporter/report_manager.rb:18:in
write_report'
from /home/dcorbin/.gem/ruby/1.8/gems/ci_reporter-1.6.3/lib/ci/reporter/report_manager.rb:17:in open' from /home/dcorbin/.gem/ruby/1.8/gems/ci_reporter-1.6.3/lib/ci/reporter/report_manager.rb:17:in
write_report'
from /home/dcorbin/.gem/ruby/1.8/gems/ci_reporter-1.6.3/lib/ci/reporter/test_unit.rb:114:in finish_suite' from /home/dcorbin/.gem/ruby/1.8/gems/ci_reporter-1.6.3/lib/ci/reporter/test_unit.rb:90:in
finished'
Using ci_reporter 1.6.4 with rspec 2.5 and we have many examples per feature. For example:
"Home page"
But when suite is executed ci_reporter only outputs 1 XML file for the "home page" test with contents for "should have company logo".
Hi,
When I run:
rake ci:setup:cucumber cucumber:all
I get the following error:
/Users/rom/.rvm/rubies/ruby-1.9.2-p180/bin/ruby -S bundle exec cucumber --require /Users/rom/.rvm/gems/ruby-1.9.2-p180/gems/ci_reporter-1.6.5/lib/ci/reporter/rake/cucumber_loader.rb --format CI::Reporter::Cucumber
Using the default profile...
rake aborted!
Command failed with status (1): [/Users/rom/.rvm/rubies/ruby-1.9.2-p180/bin...]
/Users/rom/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/file_utils.rb:53:in `block in create_shell_runner'
/Users/rom/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/file_utils.rb:45:in `call'
/Users/rom/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/file_utils.rb:45:in `sh'
/Users/rom/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/file_utils_ext.rb:36:in `sh'
/Users/rom/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-1.0.2/lib/cucumber/rake/task.rb:104:in `run'
/Users/rom/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-1.0.2/lib/cucumber/rake/task.rb:193:in `block in define_task'
/Users/rom/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:205:in `call'
/Users/rom/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:205:in `block in execute'
/Users/rom/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:200:in `each'
/Users/rom/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute'
/Users/rom/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/rom/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/rom/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/rom/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:176:in `block in invoke_prerequisites'
/Users/rom/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:174:in `each'
/Users/rom/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:174:in `invoke_prerequisites'
/Users/rom/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:157:in `block in invoke_with_call_chain'
/Users/rom/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/rom/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/rom/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke'
/Users/rom/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:112:in `invoke_task'
/Users/rom/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:90:in `block (2 levels) in top_level'
/Users/rom/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:90:in `each'
/Users/rom/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:90:in `block in top_level'
/Users/rom/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/Users/rom/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level'
/Users/rom/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:62:in `block in run'
/Users/rom/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/Users/rom/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/Users/rom/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/bin/rake:32:in `<top (required)>'
/Users/rom/.rvm/gems/ruby-1.9.2-p180/bin/rake:19:in `load'
/Users/rom/.rvm/gems/ruby-1.9.2-p180/bin/rake:19:in `<main>'
Tasks: TOP => cucumber:all => cucumber:ok
Here's a copy of my Gemfile as well if that helps:
gem 'rails', '3.0.5'
gem 'builder', '2.1.2'
gem 'sqlite3-ruby', '1.3.3', :require => 'sqlite3'
gem 'seed-fu', '2.0.1'
gem 'simplecov', '0.4.2', :require => false
gem 'capistrano', '2.6.0'
gem 'rake', '0.9.2'
gem 'ci_reporter', '1.6.5'
gem 'foreigner', '1.1.0'
gem 'devise', '1.1.7'
gem 'nokogiri', '1.5.0'
group :development, :test do
gem 'capybara', '1.0.0'
gem 'database_cleaner', '0.6.7'
gem 'cucumber-rails', '1.0.2'
gem 'rspec-rails', '2.6.1'
gem 'cucumber', '1.0.2'
gem 'spork', '0.8.5'
gem 'launchy', '2.0.5'
gem 'webrat', '0.7.3'
gem 'factory_girl_rails', '1.1.0'
gem "remarkable_activerecord", "4.0.0.alpha4"
end
group :production, :staging do
gem 'mysql2', '< 0.3'
gem 'passenger', '3.0.7'
end
And here's my Rakefile:
require File.expand_path('../config/application', __FILE__)
require 'rubygems'
require 'rake'
require 'rspec/core/rake_task'
require 'ci/reporter/rake/rspec'
require 'ci/reporter/rake/cucumber'
require 'ci/reporter/rake/test_unit'
include Rake::DSL
namespace :spec do
task :all => ["ci:setup:rspec"]
end
MyApplication::Application.load_tasks
I have a bunch of libraries with multiplatform CI builds. They run nightly to fetch new gem versions to verify compatibility. Last night, all of them that use ci_reporter updated to 1.6.7 and then failed on ruby 1.9.x with an exception like this:
/var/lib/hudson/runner-home/.rvm/gems/ruby-1.9.3-p0@ncs_mdes_warehouse/bundler/gems/ci_reporter-00a62bfeadc4/lib/ci/reporter/test_unit.rb:7:in `require': cannot load such file -- test/unit/ui/console/testrunner (LoadError)
from /var/lib/hudson/runner-home/.rvm/gems/ruby-1.9.3-p0@ncs_mdes_warehouse/bundler/gems/ci_reporter-00a62bfeadc4/lib/ci/reporter/test_unit.rb:7:in `<top (required)>'
from /var/lib/hudson/runner-home/.rvm/gems/ruby-1.9.3-p0@ncs_mdes_warehouse/bundler/gems/ci_reporter-00a62bfeadc4/lib/ci/reporter/test_suite.rb:8:in `require'
from /var/lib/hudson/runner-home/.rvm/gems/ruby-1.9.3-p0@ncs_mdes_warehouse/bundler/gems/ci_reporter-00a62bfeadc4/lib/ci/reporter/test_suite.rb:8:in `<top (required)>'
from /var/lib/hudson/runner-home/.rvm/gems/ruby-1.9.3-p0@ncs_mdes_warehouse/bundler/gems/ci_reporter-00a62bfeadc4/lib/ci/reporter/core.rb:5:in `require'
from /var/lib/hudson/runner-home/.rvm/gems/ruby-1.9.3-p0@ncs_mdes_warehouse/bundler/gems/ci_reporter-00a62bfeadc4/lib/ci/reporter/core.rb:5:in `<top (required)>'
from /var/lib/hudson/runner-home/.rvm/gems/ruby-1.9.3-p0@ncs_mdes_warehouse/bundler/gems/ci_reporter-00a62bfeadc4/lib/ci/reporter/rspec.rb:5:in `require'
from /var/lib/hudson/runner-home/.rvm/gems/ruby-1.9.3-p0@ncs_mdes_warehouse/bundler/gems/ci_reporter-00a62bfeadc4/lib/ci/reporter/rspec.rb:5:in `<top (required)>'
from /var/lib/hudson/runner-home/.rvm/gems/ruby-1.9.3-p0@ncs_mdes_warehouse/bundler/gems/ci_reporter-00a62bfeadc4/lib/ci/reporter/rake/rspec_loader.rb:6:in `require'
from /var/lib/hudson/runner-home/.rvm/gems/ruby-1.9.3-p0@ncs_mdes_warehouse/bundler/gems/ci_reporter-00a62bfeadc4/lib/ci/reporter/rake/rspec_loader.rb:6:in `<top (required)>'
from /var/lib/hudson/runner-home/.rvm/gems/ruby-1.9.3-p0@ncs_mdes_warehouse/gems/rspec-core-2.7.1/lib/rspec/core/configuration.rb:256:in `require'
from /var/lib/hudson/runner-home/.rvm/gems/ruby-1.9.3-p0@ncs_mdes_warehouse/gems/rspec-core-2.7.1/lib/rspec/core/configuration.rb:256:in `block in requires='
from /var/lib/hudson/runner-home/.rvm/gems/ruby-1.9.3-p0@ncs_mdes_warehouse/gems/rspec-core-2.7.1/lib/rspec/core/configuration.rb:256:in `map'
from /var/lib/hudson/runner-home/.rvm/gems/ruby-1.9.3-p0@ncs_mdes_warehouse/gems/rspec-core-2.7.1/lib/rspec/core/configuration.rb:256:in `requires='
from /var/lib/hudson/runner-home/.rvm/gems/ruby-1.9.3-p0@ncs_mdes_warehouse/gems/rspec-core-2.7.1/lib/rspec/core/configuration_options.rb:19:in `block in configure'
from /var/lib/hudson/runner-home/.rvm/gems/ruby-1.9.3-p0@ncs_mdes_warehouse/gems/rspec-core-2.7.1/lib/rspec/core/configuration_options.rb:18:in `each'
from /var/lib/hudson/runner-home/.rvm/gems/ruby-1.9.3-p0@ncs_mdes_warehouse/gems/rspec-core-2.7.1/lib/rspec/core/configuration_options.rb:18:in `configure'
from /var/lib/hudson/runner-home/.rvm/gems/ruby-1.9.3-p0@ncs_mdes_warehouse/gems/rspec-core-2.7.1/lib/rspec/core/command_line.rb:17:in `run'
from /var/lib/hudson/runner-home/.rvm/gems/ruby-1.9.3-p0@ncs_mdes_warehouse/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:80:in `run_in_process'
from /var/lib/hudson/runner-home/.rvm/gems/ruby-1.9.3-p0@ncs_mdes_warehouse/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:69:in `run'
from /var/lib/hudson/runner-home/.rvm/gems/ruby-1.9.3-p0@ncs_mdes_warehouse/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:10:in `block in autorun'
Unfortunately, I have not had time to trace into this to produce a minimal test case. The problem is not present on ruby 1.8.7, but I did see it on both 1.9.2-p290 and 1.9.3-p0. All of the affected projects are using ci_reporter with rspec; none use test_unit. Locking to ci_reporter 1.6.6 prevents this error.
Hi,
I have the following Rakefile:
require 'rake'
gem 'ci_reporter'
require 'ci/reporter/rake/test_unit'
task :test do
ruby 'signup.rb'
end
And the following file:
require 'rubygems'
require 'test/unit'
class SignupTest < Test::Unit::TestCase
def test_signup
assert true
end
end
When i run rake ci:setup:testunit test i get:
rm -rf test/reports
/Users/fernando/.rvm/rubies/ruby-1.9.3-p0/bin/ruby signup.rb
Run options:
# Running tests:
.
Finished tests in 0.000820s, 1219.5122 tests/s, 1219.5122 assertions/s.
1 tests, 1 assertions, 0 failures, 0 errors, 0 skips
Seems like it should have generated some kind of content in test/reports but this directory does not exist.
Any ideas of what i should do?
Seems like ci_reporter does not yet support MiniTest, which is the default for ruby 1.9.2.
This line: https://github.com/nicksieger/ci_reporter/blob/master/lib/ci/reporter/rake/test_unit.rb#L12
Will set the TESTOPTS environment variable.
In rake 0.8.7, the only valid way to pass options was the env var TESTOPTS https://github.com/jimweirich/rake/blob/rake-0.8.7/lib/rake/testtask.rb#L123
In rake 0.9.2 you can go crazy with variations of this: https://github.com/jimweirich/rake/blob/rake-0.9.2/lib/rake/testtask.rb#L105
You can also, in both versions of rake, set the options attribute with a string, but this will be ignored if the ENV VAR is set.
I think this means that by including CI reporter options set programmatically or with a different name will be ignored.
(See full trace by running task with --trace)
ssmithstone@ssmithstone-dev:~/Code/insurefirstaid.com/insurefirstaid-ror$ rake ci:setup:cucumber cucumber --trace
(in /home/ssmithstone/Code/insurefirstaid.com/insurefirstaid-ror)
** Invoke ci:setup:cucumber (first_time)
** Invoke ci:setup:cucumber_report_cleanup (first_time)
** Execute ci:setup:cucumber_report_cleanup
rm -rf features/reports
** Execute ci:setup:cucumber
** Invoke cucumber (first_time)
** Invoke cucumber:ok (first_time)
** Invoke db:test:prepare (first_time)
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:abort_if_pending_migrations
** Execute db:test:prepare
** Invoke db:test:load (first_time)
** Invoke db:test:purge (first_time)
** Invoke environment
** Execute db:test:purge
** Execute db:test:load
** Invoke db:schema:load (first_time)
** Invoke environment
** Execute db:schema:load
** Execute cucumber:ok
/usr/bin/ruby1.8 -I "/usr/lib/ruby/gems/1.8/gems/cucumber-0.6.4/lib:lib" "/usr/lib/ruby/gems/1.8/gems/cucumber-0.6.4/bin/cucumber" --require /usr/lib/ruby/gems/1.8/gems/ci_reporter-1.6.2/lib/ci/reporter/rake/cucumber_loader.rb --format CI::Reporter::Cucumber
Using the default profile...
Cucumber::Ast::Visitor is deprecated and will be removed. You no longer need to inherit from this class.
Error creating formatter: CI::Reporter::Cucumber (RuntimeError)
/usr/lib/ruby/gems/1.8/gems/cucumber-0.6.4/bin/../lib/cucumber/ast/visitor.rb:7:in initialize' /usr/lib/ruby/gems/1.8/gems/ci_reporter-1.6.2/lib/ci/reporter/rake/../../../ci/reporter/cucumber.rb:55:in
initialize'
/usr/lib/ruby/gems/1.8/gems/cucumber-0.6.4/bin/../lib/cucumber/cli/configuration.rb:144:in new' /usr/lib/ruby/gems/1.8/gems/cucumber-0.6.4/bin/../lib/cucumber/cli/configuration.rb:144:in
formatters'
/usr/lib/ruby/gems/1.8/gems/cucumber-0.6.4/bin/../lib/cucumber/cli/configuration.rb:139:in map' /usr/lib/ruby/gems/1.8/gems/cucumber-0.6.4/bin/../lib/cucumber/cli/configuration.rb:139:in
formatters'
/usr/lib/ruby/gems/1.8/gems/cucumber-0.6.4/bin/../lib/cucumber/cli/configuration.rb:64:in build_runner' /usr/lib/ruby/gems/1.8/gems/cucumber-0.6.4/bin/../lib/cucumber/cli/main.rb:58:in
execute!'
/usr/lib/ruby/gems/1.8/gems/cucumber-0.6.4/bin/../lib/cucumber/cli/main.rb:20:in execute' /usr/lib/ruby/gems/1.8/gems/cucumber-0.6.4/bin/cucumber:8 rake aborted! Command failed with status (1): [/usr/bin/ruby1.8 -I "/usr/lib/ruby/gems/1....] /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:995:in
sh'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1010:in call' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1010:in
sh'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1094:in sh' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1029:in
ruby'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1094:in ruby' /usr/lib/ruby/gems/1.8/gems/cucumber-0.6.4/lib/cucumber/rake/task.rb:68:in
run'
/usr/lib/ruby/gems/1.8/gems/cucumber-0.6.4/lib/cucumber/rake/task.rb:138:in define_task' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in
call'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in execute' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in
each'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in execute' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in
invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in synchronize' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in
invoke_with_call_chain'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in invoke_prerequisites' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in
each'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in invoke_prerequisites' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in
invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in synchronize' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in
invoke_with_call_chain'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in invoke' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in
invoke_task'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in
each'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in
standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in
run'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in standard_exception_handling' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in
run'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19
my rake , ruby is very not very good so not sure where to look as the rake ci:setup:rspec spec is working fine just that its failing with the lastest cucumber cheers
If you have unit tests that generate xml more specifically if they have CDATA sections, it breaks the outputed junit xml so you can't use it in another tool like hudson. The easiest solution for me was to just xml escape the output, maybe have an option for this?
The fix is in test_suite.rb
change
builder.cdata! self.stdout
to
builder.cdata! self.stdout.to_xs
and
builder.cdata! self.stderr
to
builder.cdata! self.stderr.to_xs
I have been using Pry (an alternative to irb) to debug and develop my tests. When I integrated ci_reporter into my TestUnit output, anytime that the Pry binding.pry is referenced in my code to bring up pry inside the program, I get an infinite loop:
TypeError: wrong argument type CI::Reporter::OutputCapture (expected File)
from /home/brian/.rvm/gems/ree-1.8.7-2012.02@reverbnation/gems/pry-0.9.8.2/lib/pry/pry_instance.rb:525:in `readline'
Any ideas?
Thanks!
undefined method 'name' for #Cucumber::Ast::Table::Cells:0x1060a2c90 (NoMethodError)
./vendor/plugins/ci_reporter/lib/ci/reporter/cucumber.rb:107:in 'before_table_row'
ci_reporter + cucumber fails on the following Gherkin pattern:
Given I have an account
| username | password | email | admin |
| joe1 | secret | [email protected] | false |
And the following step definition:
Given /^I have an account$/ do |table|
...
end
Hi.
We wanted the results to be grouped by the name of the spec file in hudson and ended up writing this monkeypatch:
module CI::Reporter
class RSpec
def description_for_with_classname(name_or_example)
spec_name(name_or_example)+description_for_without_classname(name_or_example)
end
alias_method_chain :description_for, :classname
def spec_name(name_or_example)
m = %r{spec/(?:controllers|models)/(.*_spec).rb}.match(name_or_example.location)
m&&(m[1].camelize+".")||""
end
end
end
Perhaps something that would be interesting to merge back into ci_reporter? Let me know if you have further questions.
Regards,
Morgan
When I use Test Unit's Omission and Pending, they are showing up as Failures in Hudson when I expect to see them marked as Skipped. Inspecting the xml, I see the tag "failure" where I expect to see the tag "skipped".
Github still shows only the 1.6.4 source..
Hi all,
I am running ci_reporter for a rails 2.3.11 app and ruby 1.8.7.
On running the tests, all the .xml files for the tests are having "<singleton_method_added:trunc!/>" at the beginning of the xml.
This causes the ci server to throw parsing errors while processing the xml.
Any help would be appreciated.
Ginette
As a new proto-user of ci_reporter, it seems a bit messy at the moment. The main branch doesn't support Test::Unit 2.0, the readme includes (in addition to this page) a github page that no longer exists, there are many non-converged forks and four open pull requests for different patches. What's the state of the project? Is Nick still leading it, or is someone else working up a new release? I would volunteer to help if I knew what I were doing, but I don't yet; I just want to use Test::Unit (today) and RSpec/Cucumber (tomorrow) with Jenkins CI, and I don't know that that makes me a great help for release. Are there specific tasks that need doing?
OutputCapture::initialize in test_suite.rb does not call super which means that the io object is not forwarded to DelegateClass(IO).
This was causing 'flush not defined on NilClass' errors following stdout being set to nil.
When we setup properly we get the following stack trace:
1) MessageDecorator to_json should have user id, conversation id, text, story, and created_at
Failure/Error: Unable to find matching line from backtrace
NoMethodError:
undefined method `flush' for nil:NilClass
# /home/chelsea/.jenkins/jobs/chelsea/workspace/spec/spec_helper.rb:104:in `system'
# /home/chelsea/.jenkins/jobs/chelsea/workspace/spec/spec_helper.rb:104:in `block (3 levels) in <top (required)>'
# /home/chelsea/.rvm/gems/ruby-1.9.3-p194@chelsea/gems/rspec-core-2.11.0/lib/rspec/core/example.rb:236:in `instance_eval'
# /home/chelsea/.rvm/gems/ruby-1.9.3-p194@chelsea/gems/rspec-core-2.11.0/lib/rspec/core/example.rb:236:in `instance_eval'
# /home/chelsea/.rvm/gems/ruby-1.9.3-p194@chelsea/gems/rspec-core-2.11.0/lib/rspec/core/hooks.rb:23:in `run'
# /home/chelsea/.rvm/gems/ruby-1.9.3-p194@chelsea/gems/rspec-core-2.11.0/lib/rspec/core/hooks.rb:72:in `block in run'
# /home/chelsea/.rvm/gems/ruby-1.9.3-p194@chelsea/gems/rspec-core-2.11.0/lib/rspec/core/hooks.rb:72:in `each'
# /home/chelsea/.rvm/gems/ruby-1.9.3-p194@chelsea/gems/rspec-core-2.11.0/lib/rspec/core/hooks.rb:72:in `run'
# /home/chelsea/.rvm/gems/ruby-1.9.3-p194@chelsea/gems/rspec-core-2.11.0/lib/rspec/core/hooks.rb:424:in `run_hook'
# /home/chelsea/.rvm/gems/ruby-1.9.3-p194@chelsea/gems/rspec-core-2.11.0/lib/rspec/core/example_group.rb:323:in `run_before_each_hooks'
# /home/chelsea/.rvm/gems/ruby-1.9.3-p194@chelsea/gems/rspec-core-2.11.0/lib/rspec/core/example.rb:299:in `run_before_each'
# /home/chelsea/.rvm/gems/ruby-1.9.3-p194@chelsea/gems/rspec-core-2.11.0/lib/rspec/core/example.rb:112:in `block in run'
# /home/chelsea/.rvm/gems/ruby-1.9.3-p194@chelsea/gems/draper-0.11.0/lib/draper/rspec_integration.rb:18:in `call'
# /home/chelsea/.rvm/gems/ruby-1.9.3-p194@chelsea/gems/draper-0.11.0/lib/draper/rspec_integration.rb:18:in `block (2 levels) in <module:Draper>'
# /home/chelsea/.rvm/gems/ruby-1.9.3-p194@chelsea/gems/rspec-core-2.11.0/lib/rspec/core/extensions/instance_eval_with_args.rb:16:in `instance_exec'
# /home/chelsea/.rvm/gems/ruby-1.9.3-p194@chelsea/gems/rspec-core-2.11.0/lib/rspec/core/extensions/instance_eval_with_args.rb:16:in `instance_eval_with_args'
# /home/chelsea/.rvm/gems/ruby-1.9.3-p194@chelsea/gems/rspec-core-2.11.0/lib/rspec/core/example.rb:246:in `instance_eval_with_args'
# /home/chelsea/.rvm/gems/ruby-1.9.3-p194@chelsea/gems/rspec-core-2.11.0/lib/rspec/core/hooks.rb:93:in `block (2 levels) in run'
# /home/chelsea/.rvm/gems/ruby-1.9.3-p194@chelsea/gems/rspec-core-2.11.0/lib/rspec/core/hooks.rb:91:in `call'
# /home/chelsea/.rvm/gems/ruby-1.9.3-p194@chelsea/gems/rspec-core-2.11.0/lib/rspec/core/hooks.rb:91:in `run'
# /home/chelsea/.rvm/gems/ruby-1.9.3-p194@chelsea/gems/rspec-core-2.11.0/lib/rspec/core/hooks.rb:424:in `run_hook'
# /home/chelsea/.rvm/gems/ruby-1.9.3-p194@chelsea/gems/rspec-core-2.11.0/lib/rspec/core/example_group.rb:318:in `run_around_each_hooks'
# /home/chelsea/.rvm/gems/ruby-1.9.3-p194@chelsea/gems/rspec-core-2.11.0/lib/rspec/core/example.rb:255:in `with_around_each_hooks'
# /home/chelsea/.rvm/gems/ruby-1.9.3-p194@chelsea/gems/rspec-core-2.11.0/lib/rspec/core/example.rb:110:in `run'
# /home/chelsea/.rvm/gems/ruby-1.9.3-p194@chelsea/gems/rspec-core-2.11.0/lib/rspec/core/example_group.rb:378:in `block in run_examples'
# /home/chelsea/.rvm/gems/ruby-1.9.3-p194@chelsea/gems/rspec-core-2.11.0/lib/rspec/core/example_group.rb:374:in `map'
# /home/chelsea/.rvm/gems/ruby-1.9.3-p194@chelsea/gems/rspec-core-2.11.0/lib/rspec/core/example_group.rb:374:in `run_examples'
# /home/chelsea/.rvm/gems/ruby-1.9.3-p194@chelsea/gems/rspec-core-2.11.0/lib/rspec/core/example_group.rb:360:in `run'
# /home/chelsea/.rvm/gems/ruby-1.9.3-p194@chelsea/gems/rspec-core-2.11.0/lib/rspec/core/example_group.rb:361:in `block in run'
# /home/chelsea/.rvm/gems/ruby-1.9.3-p194@chelsea/gems/rspec-core-2.11.0/lib/rspec/core/example_group.rb:361:in `map'
# /home/chelsea/.rvm/gems/ruby-1.9.3-p194@chelsea/gems/rspec-core-2.11.0/lib/rspec/core/example_group.rb:361:in `run'
# /home/chelsea/.rvm/gems/ruby-1.9.3-p194@chelsea/gems/rspec-core-2.11.0/lib/rspec/core/command_line.rb:28:in `block (2 levels) in run'
# /home/chelsea/.rvm/gems/ruby-1.9.3-p194@chelsea/gems/rspec-core-2.11.0/lib/rspec/core/command_line.rb:28:in `map'
# /home/chelsea/.rvm/gems/ruby-1.9.3-p194@chelsea/gems/rspec-core-2.11.0/lib/rspec/core/command_line.rb:28:in `block in run'
# /home/chelsea/.rvm/gems/ruby-1.9.3-p194@chelsea/gems/rspec-core-2.11.0/lib/rspec/core/reporter.rb:34:in `report'
# /home/chelsea/.rvm/gems/ruby-1.9.3-p194@chelsea/gems/rspec-core-2.11.0/lib/rspec/core/command_line.rb:25:in `run'
# /home/chelsea/.rvm/gems/ruby-1.9.3-p194@chelsea/gems/rspec-core-2.11.0/lib/rspec/core/runner.rb:66:in `rescue in run'
# /home/chelsea/.rvm/gems/ruby-1.9.3-p194@chelsea/gems/rspec-core-2.11.0/lib/rspec/core/runner.rb:62:in `run'
# /home/chelsea/.rvm/gems/ruby-1.9.3-p194@chelsea/gems/rspec-core-2.11.0/lib/rspec/core/runner.rb:8:in `block in autorun'
We're using Ruby 1.9.3 and pointing at the (now current) CI Reporter master
Hello,
I am using hudson version 2.2.0 and ruby version 1.9.2p290 with your lastest version of ci_reporter. I am running my cucumber and spec tests with the ci:setup:cucumber and ci:setup:rspec respectively. The tests run and the reports are generated.
However when I specify the Publish JUnit test result report and specify the Test report XMLs as features/reports/_.xml,spec/reports/_xml, Hudson reports the following exception:
Recording test results
ERROR: Publisher hudson.tasks.junit.JUnitResultArchiver aborted due to exception
java.lang.NullPointerException
at hudson.tasks.junit.CaseResult.getPackageName(CaseResult.java:266)
at hudson.tasks.junit.TestResult.tally(TestResult.java:499)
at hudson.tasks.junit.JUnitParser$ParseResultCallable.invoke(JUnitParser.java:115)
at hudson.tasks.junit.JUnitParser$ParseResultCallable.invoke(JUnitParser.java:87)
at hudson.FilePath.act(FilePath.java:758)
at hudson.FilePath.act(FilePath.java:740)
at hudson.tasks.junit.JUnitParser.parse(JUnitParser.java:83)
at hudson.tasks.junit.JUnitResultArchiver.parse(JUnitResultArchiver.java:132)
at hudson.tasks.junit.JUnitResultArchiver.perform(JUnitResultArchiver.java:144)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:630)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:608)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:584)
at hudson.model.Build$RunnerImpl.post2(Build.java:159)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:553)
at hudson.model.Run.run(Run.java:1390)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:145)
Can you please tell me what I need to do to get this working properly.
Best regards,
Rebecca
Hi, I also have to add an issue on 1.9.2 after migrating an app to it :(
https://gist.github.com/60e8839b49133f64d79e
running rake all under ruby-1.9.2 having this in my Rakefile:
require 'bundler'
Bundler::GemHelper.install_tasks
Bundler.setup
require 'rake'
require 'rspec/core/rake_task'
require 'ci/reporter/rake/rspec'
RSpec::Core::RakeTask.new(:spec) do |s|
s.rspec_opts = "--format=#{ENV['RSPEC_FORMAT'] || 'nested'} --colour"
end
task :default => :spec
RSpec::Core::RakeTask.new(:all => ["ci:setup:rspec"]) do |t|
t.pattern = '*_/__spec.rb'
end
I'm getting this error with Rspec 1.3.2 and the latest ci_reporter (1.7.0). The command I'm running is:
RAILS_ENV=test SPEC_OPTS="--require 'ci/reporter/rake/rspec' --format CI::Reporter::RSpec" bundle exec rake spec
Has anyone encountered this?
Thanks,
Tom
Hi, you recently took in a patch to allow Test Unit Omissions and Pendings. It doesn't work in Ruby 1.9 because constants are symbols instead of strings now. Please update line 16 of lib/ci/reporter/test_unit.rb to check Test::Unit.constants for either "Omission" or :Omission
I see that you can set an environmental variable for the reports:
+CI_REPORTS+: if set, points to a directory where report files will be written.
Is there a way to programatically include it in either the RAKE file or the individual test script?
Hey!
We are using ci_reporter with jenkins. Another tasks installed in addition to json 1.7.5 1.7.6. Now these two versions are installed.
This command should execute the command with the fixed json version, which is 1.7.5.
bundle exec ruby -r GEM_PATH/lib/ci/reporter/rake/cucumber_loader -S cucumber --format CI::Reporter::Cucumber
But nevertheless I got the following error:
/usr/local/rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.2.2/lib/bundler/runtime.rb:31:in `block in setup': You have already activated json 1.7.6, but your Gemfile requires json 1.7.5. Using bundle exec may solve this. (Gem::LoadError) from /usr/local/rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.2.2/lib/bundler/runtime.rb:17:in `setup'
from /usr/local/rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.2.2/lib/bundler.rb:116:in `setup'
from /usr/local/rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.2.2/lib/bundler/setup.rb:7:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
Any idea?
A failing test under JRuby with MiniTest currently causes ci_reporter itself to bomb out rather than reporting the exception which occurred in the test:
[java] Caused by: org.jruby.exceptions.RaiseException: (NoMethodError) undefined method `exception' for java.lang.reflect.UndeclaredThrowableException:Java::JavaLangReflect::UndeclaredThrowableException
[java] at RUBY.name(jar:file:ruby-testing-gems.jar!/gems/ci_reporter-1.7.0/lib/ci/reporter/minitest.rb:52)
[java] at RUBY.to_xml(jar:file:ruby-testing-gems.jar!/gems/ci_reporter-1.7.0/lib/ci/reporter/test_suite.rb:146)
[java] at org.jruby.RubyArray.each(org/jruby/RubyArray.java:1612)
[java] at RUBY.to_xml(jar:file:ruby-testing-gems.jar!/gems/ci_reporter-1.7.0/lib/ci/reporter/test_suite.rb:140)
[java] at org.jruby.RubyProc.call(org/jruby/RubyProc.java:259)
[java] at RUBY._nested_structures(jar:file:ruby-testing-gems.jar!/gems/builder-3.0.0/lib/builder/xmlbase.rb:155)
[java] at RUBY.method_missing(jar:file:ruby-testing-gems.jar!/gems/builder-3.0.0/lib/builder/xmlbase.rb:63)
[java] at RUBY.to_xml(jar:file:ruby-testing-gems.jar!/gems/ci_reporter-1.7.0/lib/ci/reporter/test_suite.rb:136)
[java] at RUBY.to_xml(jar:file:ruby-testing-gems.jar!/gems/ci_reporter-1.7.0/lib/ci/reporter/test_suite.rb:86)
[java] at org.jruby.RubyArray.each(org/jruby/RubyArray.java:1612)
[java] at RUBY.to_xml(jar:file:ruby-testing-gems.jar!/gems/ci_reporter-1.7.0/lib/ci/reporter/test_suite.rb:85)
[java] at org.jruby.RubyProc.call(org/jruby/RubyProc.java:259)
[java] at RUBY._nested_structures(jar:file:ruby-testing-gems.jar!/gems/builder-3.0.0/lib/builder/xmlbase.rb:155)
[java] at RUBY.method_missing(jar:file:ruby-testing-gems.jar!/gems/builder-3.0.0/lib/builder/xmlbase.rb:63)
[java] at RUBY.to_xml(jar:file:ruby-testing-gems.jar!/gems/ci_reporter-1.7.0/lib/ci/reporter/test_suite.rb:84)
[java] at RUBY.write_report(jar:file:ruby-testing-gems.jar!/gems/ci_reporter-1.7.0/lib/ci/reporter/report_manager.rb:18)
[java] at org.jruby.RubyIO.open(org/jruby/RubyIO.java:1180)
[java] at RUBY.write_report(jar:file:ruby-testing-gems.jar!/gems/ci_reporter-1.7.0/lib/ci/reporter/report_manager.rb:17)
[java] at RUBY.finish_suite(jar:file:ruby-testing-gems.jar!/gems/ci_reporter-1.7.0/lib/ci/reporter/minitest.rb:195)
[java] at RUBY._run_suite(jar:file:ruby-testing-gems.jar!/gems/ci_reporter-1.7.0/lib/ci/reporter/minitest.rb:96)
[java] at RUBY._run_suites(jar:file:ruby-testing-gems.jar!/gems/ci_reporter-1.7.0/lib/ci/reporter/minitest.rb:83)
[java] at org.jruby.RubyArray.map(org/jruby/RubyArray.java:2355)
[java] at RUBY._run_suites(jar:file:ruby-testing-gems.jar!/gems/ci_reporter-1.7.0/lib/ci/reporter/minitest.rb:83)
[java] at RUBY._run_anything(jar:file:ruby-testing-gems.jar!/gems/ci_reporter-1.7.0/lib/ci/reporter/minitest.rb:75)
[java] at RUBY.run_tests(jar:file:/ruby-complete.jar!/META-INF/jruby.home/lib/ruby/1.9/minitest/unit.rb:909)
[java] at org.jruby.RubyBasicObject.__send__(org/jruby/RubyBasicObject.java:1667)
[java] at org.jruby.RubyKernel.send(org/jruby/RubyKernel.java:2060)
[java] at RUBY._run(jar:file:/ruby-complete.jar!/META-INF/jruby.home/lib/ruby/1.9/minitest/unit.rb:896)
Seems like it's expecting a Failure but actually getting the exception object itself, but then attempting to call exception on it to get the exception.
This is on version 1.7.0 but nothing in the change history since then sounds like it is MiniTest-related.
4) PingMailer #material_sample
Failure/Error: Unable to find matching line from backtrace
NoMethodError:
undefined method `metadata' for #<RSpec::Core::Metadata:0x000000182d6d98>
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.1/lib/rspec/core/formatters/base_formatter.rb:125:in `format_backtrace'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/ci_reporter-1.8.0/lib/ci/reporter/rspec.rb:85:in `location'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/ci_reporter-1.8.0/lib/ci/reporter/test_suite.rb:163:in `block (3 levels) in to_xml'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/builder-3.0.4/lib/builder/xmlbase.rb:170:in `call'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/builder-3.0.4/lib/builder/xmlbase.rb:170:in `_nested_structures'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/builder-3.0.4/lib/builder/xmlbase.rb:63:in `tag!'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/ci_reporter-1.8.0/lib/ci/reporter/test_suite.rb:161:in `block (2 levels) in to_xml'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/ci_reporter-1.8.0/lib/ci/reporter/test_suite.rb:155:in `each'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/ci_reporter-1.8.0/lib/ci/reporter/test_suite.rb:155:in `block in to_xml'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/builder-3.0.4/lib/builder/xmlbase.rb:170:in `call'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/builder-3.0.4/lib/builder/xmlbase.rb:170:in `_nested_structures'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/builder-3.0.4/lib/builder/xmlbase.rb:63:in `tag!'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/builder-3.0.4/lib/builder/xmlbase.rb:184:in `block (2 levels) in cache_method_call'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/ci_reporter-1.8.0/lib/ci/reporter/test_suite.rb:151:in `to_xml'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/ci_reporter-1.8.0/lib/ci/reporter/test_suite.rb:101:in `block (2 levels) in to_xml'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/ci_reporter-1.8.0/lib/ci/reporter/test_suite.rb:100:in `each'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/ci_reporter-1.8.0/lib/ci/reporter/test_suite.rb:100:in `block in to_xml'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/builder-3.0.4/lib/builder/xmlbase.rb:170:in `call'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/builder-3.0.4/lib/builder/xmlbase.rb:170:in `_nested_structures'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/builder-3.0.4/lib/builder/xmlbase.rb:63:in `tag!'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/builder-3.0.4/lib/builder/xmlbase.rb:88:in `method_missing'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/ci_reporter-1.8.0/lib/ci/reporter/test_suite.rb:99:in `to_xml'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/ci_reporter-1.8.0/lib/ci/reporter/report_manager.rb:18:in `block in write_report'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/ci_reporter-1.8.0/lib/ci/reporter/report_manager.rb:17:in `open'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/ci_reporter-1.8.0/lib/ci/reporter/report_manager.rb:17:in `write_report'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/ci_reporter-1.8.0/lib/ci/reporter/rspec.rb:194:in `write_report'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/ci_reporter-1.8.0/lib/ci/reporter/rspec.rb:199:in `new_suite'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/ci_reporter-1.8.0/lib/ci/reporter/rspec.rb:119:in `example_group_started'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.1/lib/rspec/core/reporter.rb:98:in `block in notify'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.1/lib/rspec/core/reporter.rb:97:in `each'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.1/lib/rspec/core/reporter.rb:97:in `notify'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.1/lib/rspec/core/reporter.rb:50:in `example_group_started'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.1/lib/rspec/core/example_group.rb:365:in `run'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.1/lib/rspec/core/example_group.rb:370:in `block in run'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.1/lib/rspec/core/example_group.rb:370:in `map'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.1/lib/rspec/core/example_group.rb:370:in `run'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.1/lib/rspec/core/command_line.rb:28:in `block (2 levels) in run'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.1/lib/rspec/core/command_line.rb:28:in `map'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.1/lib/rspec/core/command_line.rb:28:in `block in run'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.1/lib/rspec/core/reporter.rb:34:in `report'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.1/lib/rspec/core/command_line.rb:25:in `run'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.1/lib/rspec/core/runner.rb:77:in `rescue in run'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.1/lib/rspec/core/runner.rb:73:in `run'
# /var/lib/jenkins/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.12.1/lib/rspec/core/runner.rb:17:in `block in autorun'
When an exception message is nil, ci_reporter crashes, and does not produce any XML logs.
The error I get is: ci/reporter/test_suite.rb:79:in
trunc!': undefined method `sub' for nil:NilClass (NoMethodError)
This was tested on ci_reporter 1.7.0.
I've worked around this issue with monkeypatching:
require 'ci/reporter/test_suite'
class CI::Reporter::TestSuite
# Creates an xml string containing the test suite results.
def to_xml
builder = create_builder
# more recent version of Builder doesn't need the escaping
def builder.trunc!(txt)
return '' if txt.nil?
txt.sub(/\n.*/m, '...')
end
builder.instruct!
attrs = {}
each_pair {|k,v| attrs[k] = builder.trunc!(v.to_s) unless v.nil? || v.to_s.empty? }
builder.testsuite(attrs) do
@testcases.each do |tc|
tc.to_xml(builder)
end
builder.tag! "system-out" do
builder.text!(self.stdout || '' )
end
builder.tag! "system-err" do
builder.text!(self.stderr || '' )
end
end
end
end
class CI::Reporter::TestCase
# Writes xml representing the test result to the provided builder.
def to_xml(builder)
attrs = {}
each_pair {|k,v| attrs[k] = builder.trunc!(v.to_s) unless v.nil? || v.to_s.empty?}
builder.testcase(attrs) do
if skipped
builder.skipped
else
failures.each do |failure|
message = failure.message || ''
tag = case failure.class.name
when /TestUnitSkipped/ then :skipped
when /TestUnitError/, /MiniTestError/ then :error
else :failure end
builder.tag!(tag, :type => builder.trunc!(failure.name), :message => builder.trunc!(message)) do
builder.text!("#{message} (#{failure.name})\n")
builder.text!(failure.location)
end
end
end
end
end
end
Test case:
describe "Test" do
before(:all) do
nil[]
end
it "should do something" do
1.should == 2
end
end
Error:
ci_reporter-1.6.0/lib/ci/reporter/rake/../../../ci/reporter/rspec.rb:85:in `example_failed': undefined method `finish' for nil:NilClass (NoMethodError)
from /Users/be/.gem/ruby/1.8/gems/rspec-1.3.0/lib/spec/runner/reporter.rb:44:in `example_failed'
from /Users/be/.gem/ruby/1.8/gems/rspec-1.3.0/lib/spec/runner/reporter.rb:43:in `each'
from /Users/be/.gem/ruby/1.8/gems/rspec-1.3.0/lib/spec/runner/reporter.rb:43:in `example_failed'
from /Users/be/.gem/ruby/1.8/gems/rspec-1.3.0/lib/spec/example/example_group_methods.rb:202:in `run_before_all'
from /Users/be/.gem/ruby/1.8/gems/rspec-1.3.0/lib/spec/example/example_group_methods.rb:102:in `run'
from /Users/be/.gem/ruby/1.8/gems/rspec-1.3.0/lib/spec/runner/example_group_runner.rb:23:in `run'
from /Users/be/.gem/ruby/1.8/gems/rspec-1.3.0/lib/spec/runner/example_group_runner.rb:22:in `each'
from /Users/be/.gem/ruby/1.8/gems/rspec-1.3.0/lib/spec/runner/example_group_runner.rb:22:in `run'
from /Users/be/.gem/ruby/1.8/gems/rspec-1.3.0/lib/spec/runner/options.rb:152:in `run_examples'
from /Users/be/.gem/ruby/1.8/gems/rspec-1.3.0/lib/spec/runner/command_line.rb:9:in `run'
from /Users/be/.gem/ruby/1.8/gems/rspec-1.3.0/bin/spec:5
Typical OS file name restrictions are 1023 characters in all, 255 per component. Given enough wordy describe/context/it strings, the component limit is easy to exceed. How about replacing the last N characters of an over-long name with a SHA of the remainder?
The stdlib 'logger' class uses .write() on STDOUT but doesn't seem to get captured by one of the overridden puts/write/... statements in ci_reporter.
Any idea how to capture logger output?
Basic example:
require "rubygems"
require "test/unit"
require "logger"
require 'ci/reporter/rake/test_unit_loader.rb'
class Test01Example < Test::Unit::TestCase
def test_01_ex
log = Logger.new(STDOUT)
log.level = Logger::INFO
log.info("I am test number 1")
a = 5
b = 6
assert(b > a, "Oh noes! Math changed!")
end
end
console output:
#ruby example.rb
Loaded suite example
Started
I, [2011-06-28T13:39:16.438661 #39840] INFO -- : I am test number 1
.
Finished in 0.000279 seconds.
1 tests, 1 assertions, 0 failures, 0 errors
result:
<?xml version="1.0" encoding="UTF-8"?>
<testsuite assertions="1" errors="0" tests="1" failures="0" time="0.000231" skipped="0" name="Test01Example">
<testcase assertions="1" time="0.00011" name="test_01_ex">
</testcase>
<system-out>
</system-out>
<system-err>
</system-err>
</testsuite>
Version 1.6.3:
My tests do not require any rubygems. Consequently, ci_reporter blows up when it does "require 'builder'". You should also require rubygems.
I followed the instructions and added this to the top of my rails 3 Rakefile:
require 'rubygems'
#require 'ci/reporter/rake/rspec' # use this if you're using RSpec
#require 'ci/reporter/rake/cucumber' # use this if you're using Cucumber
require 'ci/reporter/rake/test_unit' # use this if you're using Test::Unit
And then run:
$ rake ci:setup:testunit test:units CI_REPORTS=results
(in /home/docwhat/work/rails-app)
rm -rf results
Loaded suite /home/docwhat/.rvm/gems/ruby-1.9.2-p0@rails-app/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
...
Finished in 0.203221351 seconds.
3 tests, 3 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
0% passed
14.76 tests/s, 14.76 assertions/s
It says it removes results
, but nothing different happens. No directory is created, etc.
Environment: Ruby 1.9.3-p0, test-unit 2.4.5
When 'omit' is used the CI_reporter fails:
./usr/local/rvm/gems/ruby-1.9.3-p0/gems/ci_reporter-1.7.0/lib/ci/reporter/test_unit.rb:29:in name': undefined method
exception' for #Test::Unit::Omission:0x8f8660c (NoMethodError)
from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/ci_reporter-1.7.0/lib/ci/reporter/test_suite.rb:146:in block (2 levels) in to_xml' from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/ci_reporter-1.7.0/lib/ci/reporter/test_suite.rb:140:in
each'
from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/ci_reporter-1.7.0/lib/ci/reporter/test_suite.rb:140:in `block in to_xml'
The test example:
require 'rubygems'
gem 'test-unit'
require 'test/unit'
require "ci/reporter/rake/test_unit_loader"
class TC_MyTests < Test::Unit::TestCase
def test_01_login
puts "Logged in"
end
def test_02_omit
puts "Hello 1"
omit()
puts "Hello 2"
end
def test_03_logoff
puts "Logged off"
end
end
I follow the instructions editing my rakefile and when I run the command it fails
$ rake ci:setup:testunit test
rm -rf test/reports
/home/user/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `require': cannot load such file -- test/unit/ui/console/testrunner (LoadError)
from /home/user/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `block in require'
from /home/user/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:236:in `load_dependency'
from /home/user/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `require'
from /home/user/.rvm/gems/ruby-1.9.3-p194/gems/ci_reporter-1.7.0/lib/ci/reporter/test_unit.rb:7:in `<top (required)>'
from /home/user/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `require'
from /home/user/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `block in require'
from /home/user/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:236:in `load_dependency'
from /home/user/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `require'
from /home/user/.rvm/gems/ruby-1.9.3-p194/gems/ci_reporter-1.7.0/lib/ci/reporter/rake/test_unit_loader.rb:6:in `<top (required)>'
from /home/user/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `require'
from /home/user/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `block in require'
from /home/user/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:236:in `load_dependency'
from /home/user/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `require'
from /home/user/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:15:in `block in <main>'
from /home/user/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:4:in `select'
from /home/user/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:4:in `<main>'
/home/user/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `require': cannot load such file -- test/unit/ui/console/testrunner (LoadError)
from /home/user/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `block in require'
from /home/user/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:236:in `load_dependency'
from /home/user/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `require'
from /home/user/.rvm/gems/ruby-1.9.3-p194/gems/ci_reporter-1.7.0/lib/ci/reporter/test_unit.rb:7:in `<top (required)>'
from /home/user/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `require'
from /home/user/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `block in require'
from /home/user/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:236:in `load_dependency'
from /home/user/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `require'
from /home/user/.rvm/gems/ruby-1.9.3-p194/gems/ci_reporter-1.7.0/lib/ci/reporter/rake/test_unit_loader.rb:6:in `<top (required)>'
from /home/user/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `require'
from /home/user/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `block in require'
from /home/user/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:236:in `load_dependency'
from /home/user/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `require'
from /home/user/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:15:in `block in <main>'
from /home/user/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:4:in `select'
from /home/user/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:4:in `<main>'
/home/user/.rvm/gems/ruby-1.9.3-p194/gems/ci_reporter-1.7.0/lib/ci/reporter/test_unit.rb:7:in `require': cannot load such file -- test/unit/ui/console/testrunner (LoadError)
from /home/user/.rvm/gems/ruby-1.9.3-p194/gems/ci_reporter-1.7.0/lib/ci/reporter/test_unit.rb:7:in `<top (required)>'
from /home/user/.rvm/gems/ruby-1.9.3-p194/gems/ci_reporter-1.7.0/lib/ci/reporter/rake/test_unit_loader.rb:6:in `require'
from /home/user/.rvm/gems/ruby-1.9.3-p194/gems/ci_reporter-1.7.0/lib/ci/reporter/rake/test_unit_loader.rb:6:in `<top (required)>'
from /home/user/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:15:in `require'
from /home/user/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:15:in `block in <main>'
from /home/user/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:4:in `select'
from /home/user/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:4:in `<main>'
Errors running test:units! #<RuntimeError: Command failed with status (1): [/home/user/.rvm/rubies/ruby-1.9.3-p194/bi...]>
Errors running test:functionals! #<RuntimeError: Command failed with status (1): [/home/user/.rvm/rubies/ruby-1.9.3-p194/bi...]>
Errors running test:integration! #<RuntimeError: Command failed with status (1): [/home/user/.rvm/rubies/ruby-1.9.3-p194/bi...]>
There's a 1.7.1 gem, but no 1.7.1 tag or mention in the changelog. There's not even any commits around the date of the gem release. Is it being sourced from another repo now?
After ci_reporter is bundled in project, each time I run rake task I receive the following message:
config.gem: Unpacked gem ci_reporter-1.6.2 in vendor/gems has no specification file. Run 'rake gems:refresh_specs' to fix this.
Even after gems:refresh_specs, .specification file is not being created.
Nice tool, makes hudson integration a breeze.
I have been using Test::Unit 2.0.x for a number of the features (startup, shutdown and omit mainly), there hasn't been any issue with ci reporter apart from an exception on test omisison (using the omit function). I have been using the attached monkey patch to handle the omisison and pending cases. This atleast stops the exceptions and shows these tests as passing. That is not ideal, it should actually probably fill in the "skipped" attribute in the junit xml but I couldn't find an example of the syntax for a skipped test so I couldn't implement that feature.
Sorry for the monkeypatch, not fork/pull request but I am trying to avoid having too many "self-branded" gems in our build system.
Using RSpec 2.7.0 and latest CI Reporter, I get an infinite loop on filename until it gets the filename to be too long, i.e.:
/tmp/t/SPEC-SpecStateValidator-SpecStateValidator-validate-SpecStateValidator-SpecStateValidator-validate-when-the-user-changed-state-SpecStateValidator-SpecStateValidator-validate-SpecStateValidator-SpecStateValidator-validate-when-the-user-changed-state-and-it-was-deleted-to-active.xml
I have ruby 1.9.2, ci_reporter (1.6.3), test-unit (1.2.3)
require 'test/unit'
require 'ci/reporter/rake/test_unit_loader'
class TC_MyTest < Test::Unit::TestCase
def test_fail
assert(false, 'Assertion was false.')
end
def test_succeed
assert(true, 'Assertion was true.')
end
Changing require to:
require 'ci/reporter/rake/test_unit'
c:/ruby192/lib/ruby/gems/1.9.1/gems/ci_reporter-1.6.3/lib/ci/reporter/rake/test_unit.rb:7:in <top (required)>': undefined method
namespace' for main:Object (NoMethodError)
from internal:lib/rubygems/custom_require:33:in require' from <internal:lib/rubygems/custom_require>:33:in
rescue in require'
from internal:lib/rubygems/custom_require:29:in require' from ci_test.rb:2:in
When handling dynamically generated rspec examples, ci_reporter generates elements without the 'name' attribute. This screws up Hudson's JUnit parsing.
When handling an rspec like this:
describe 12345 do
subject {12345}
it {should eql(12345)}
its(:to_i) {should eql(12345)}
it "should bla"
end
I the testcase elements don't reliably have names:
I dug into it, and it's because of how ci/reporter/rspec.rb gets the example name. In cases where the example name is dynamically generated, the Spec::Example::ExampleProxy#description is nil in example_started, and doesn't get it's description set until example_failed, example_passed, example_pending.
As a result, the XML that's output is missing the name attribute, since it is nil.
Following the instructions to the best of my ability (I've only just started working with ruby): i get no test/reports created. Setting CI_REPORTS seems to have no effect either
My Rakefile is
require File.expand_path('../config/application', __FILE__)
require 'rake'
Rails::Application.load_tasks
require 'rubygems'
gem 'ci_reporter'
require 'ci/reporter/rake/test_unit'
My understanding is shoulda is Test::Unit compatible
(Note that the instructions refer to a rails plugin but I can't find that anywhere)
The following problem occurs when using the ’ci_reporter’ (version 1.7.0) with unit-test and Ruby 1.9.3:
uninitialized constant Test::Unit::UI::Console::Diff
Ruby stack output:
/usr/local/rvm/gems/ruby-1.9.3-p0/gems/test-unit-2.4.5/lib/test/unit/ui/console/testrunner.rb:439:in `<module:Console>': uninitialized constant Test::Unit::UI::Console::Diff (NameError)
from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/test-unit-2.4.5/lib/test/unit/ui/console/testrunner.rb:17:in `<module:UI>'
from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/test-unit-2.4.5/lib/test/unit/ui/console/testrunner.rb:16:in `<module:Unit>'
from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/test-unit-2.4.5/lib/test/unit/ui/console/testrunner.rb:15:in `<module:Test>'
from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/test-unit-2.4.5/lib/test/unit/ui/console/testrunner.rb:14:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `require'
from /usr/local/rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `rescue in require'
from /usr/local/rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/ci_reporter-1.7.0/lib/ci/reporter/test_unit.rb:7:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/local/rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/ci_reporter-1.7.0/lib/ci/reporter/rake/test_unit_loader.rb:6:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `require'
from /usr/local/rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `rescue in require'
from /usr/local/rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
…
I’ve tried with the suggestion presented in 'http://bugs.ruby-lang.org/issues/3561' using the following require lines in the test case:
require 'rubygems'
gem 'test-unit'
require 'test/unit'
require 'ci/reporter/rake/test_unit_loader'
But on Linux Debian (squeeze) it doesn’t work and fails with the above error/stack trace.
I'm able to get output to both formatters when I run from the command line like this:
rm -rf hudson/reports/spec/*
CI_REPORTS=hudson/reports/spec/ spec --require \
/Library/Ruby/Gems/1.8/gems/ci_reporter-1.6.2/lib/ci/reporter/rake/rspec_loader \
--format CI::Reporter::RSpec --format html:hudson/reports/spec/report.html spec
But when I run from a rake task like this:
rake hudson:spec
With a rake file that looks like this I only get the junit output:
namespace :hudson do
def rspec_report_path
"hudson/reports/spec/"
end
task :spec_report_setup do
rm_rf rspec_report_path
mkdir_p rspec_report_path
end
if defined? Spec
Spec::Rake::SpecTask.new do |t|
t.spec_opts = %{--profile default --format CI::Reporter::RSpec --format html:#{rspec_report_path}report.html}
end
end
namespace :setup do
task :pre_ci do
ENV["CI_REPORTS"] = rspec_report_path
gem 'ci_reporter'
require 'ci/reporter/rake/rspec'
end
task :rspec => [:pre_ci, "ci:setup:rspec"]
end
desc "run the RSpec tests"
task :spec => ["hudson:setup:rspec", :spec_report_setup, 'db:migrate', 'db:test:prepare', 'rake:spec']
end
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.