natritmeyer / yarjuf Goto Github PK
View Code? Open in Web Editor NEWYet Another RSpec JUnit Formatter (for Hudson/Jenkins)
License: BSD 3-Clause "New" or "Revised" License
Yet Another RSpec JUnit Formatter (for Hudson/Jenkins)
License: BSD 3-Clause "New" or "Revised" License
In the latest version of rspec_core the format_backtrace was "fixed" by adding in 2 arguments: rspec/rspec-core@f06254c
So now running the the formatter results in a Argument Error:
d:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.12.1/lib/rspec/core/formatters/
base_formatter.rb:124:in `format_backtrace': wrong number of arguments (1 for 2) (ArgumentError)
from d:/Ruby193/lib/ruby/gems/1.9.1/gems/yarjuf-1.0.2/lib/yarjuf.rb:45:in `failure_details_for'
from d:/Ruby193/lib/ruby/gems/1.9.1/gems/yarjuf-1.0.2/lib/yarjuf.rb:69:in `block (6 levels) in dump_summary'
(Apologies in advance if I’m overlooking the blindingly obvious, as I am a relatively new yarjuf user.)
We have a Jenkins job configured to generate color output, with Jenkins parsing the ANSI color escape sequences. This makes it very easy to spot errors (red) amidst the successes (green) when skimming the log, and up ’til now yarjuf has had no issue with that.
However, it turns out that if a failing test case happens to generate a diff, then that diff is also colorized. In the log, that’s fine and welcome. However, yarjuf appears to incorporate the unmodified output, complete with color-generating escape sequences, into the XML, causing JUnit processing to reject results.xml “An invalid XML character (Unicode: 0x1b) was found in the CDATA section.”
The expedient thing is to simply strip out the escape sequences, using sed, after rspec has finished its work, with a command like this:
sed -r -e "s/\x1B\[[0-9]+m//g" -i results.xml
But it would be nice if yarjuf knew to do the equivalent right out of the box.
Versions in use:
Jenkins: 1.509
rspec: 2.13.0
Please let me know if any additional information would be helpful — or if I’m going about things in a fundamentally-wrong way.
I can't get the versions below 2.0 (and I'm using rspec under version 3, so until I upgrade it won't work) to output an xml that isn't 0 bytes. I'm not sure what additional information I can include. I put a few debug statements in the main rb file and the only one I was able to trigger was in the initialize method. Any ideas what's going wrong?
Hi,
I followed your HOWTO regarding jaryuf and Jenkins. The XML file is generated and there are values. However jenkins shows me "no tests" on the dashboard:
but when I go into the link then the Tests are there. Now unfortunately my Graph remains empty:
Do you have any ideas what could be wrong?
thank you
p
Using JRuby 1.7.2, any spec that fails, will cause a crash. If test is successful then a report gets generated, everything fine. But of course I would like to get a report if test fails. I have tested on Ubuntu 12.04 and Windows 7, same error.
Invoking with command:
jruby -S bundle exec rspec -f JUnit -o report.xml spec\models\lol_spec.rb
example spec that will fail and thus crash:
require 'spec_helper'
describe 'lol' do
it 'makes me smile' do
false.should be_true
end
end
this gives the following error:
NoMethodError: undefined method `[]' for #<RSpec::Core::Example:0x43dc9903>
format_backtrace at c:/jruby-1.7.2/lib/ruby/gems/shared/gems/rspec-core-2.12.0/lib/rspec/core/formatters/helpers.rb:8
failure_details_for at c:/jruby-1.7.2/lib/ruby/gems/shared/gems/yarjuf-1.0.5/lib/yarjuf.rb:43
build_failed_test at c:/jruby-1.7.2/lib/ruby/gems/shared/gems/yarjuf-1.0.5/lib/yarjuf.rb:110
call at org/jruby/RubyProc.java:249
_nested_structures at c:/jruby-1.7.2/lib/ruby/gems/shared/gems/builder-3.0.4/lib/builder/xmlbase.rb:170
tag! at c:/jruby-1.7.2/lib/ruby/gems/shared/gems/builder-3.0.4/lib/builder/xmlbase.rb:63
method_missing at c:/jruby-1.7.2/lib/ruby/gems/shared/gems/builder-3.0.4/lib/builder/xmlbase.rb:88
build_failed_test at c:/jruby-1.7.2/lib/ruby/gems/shared/gems/yarjuf-1.0.5/lib/yarjuf.rb:109
build_test at c:/jruby-1.7.2/lib/ruby/gems/shared/gems/yarjuf-1.0.5/lib/yarjuf.rb:101
call at org/jruby/RubyProc.java:249
_nested_structures at c:/jruby-1.7.2/lib/ruby/gems/shared/gems/builder-3.0.4/lib/builder/xmlbase.rb:170
tag! at c:/jruby-1.7.2/lib/ruby/gems/shared/gems/builder-3.0.4/lib/builder/xmlbase.rb:63
method_missing at c:/jruby-1.7.2/lib/ruby/gems/shared/gems/builder-3.0.4/lib/builder/xmlbase.rb:88
build_test at c:/jruby-1.7.2/lib/ruby/gems/shared/gems/yarjuf-1.0.5/lib/yarjuf.rb:98
build_all_tests at c:/jruby-1.7.2/lib/ruby/gems/shared/gems/yarjuf-1.0.5/lib/yarjuf.rb:89
each at org/jruby/RubyArray.java:1613
build_all_tests at c:/jruby-1.7.2/lib/ruby/gems/shared/gems/yarjuf-1.0.5/lib/yarjuf.rb:88
build_test_suite at c:/jruby-1.7.2/lib/ruby/gems/shared/gems/yarjuf-1.0.5/lib/yarjuf.rb:83
call at org/jruby/RubyProc.java:249
_nested_structures at c:/jruby-1.7.2/lib/ruby/gems/shared/gems/builder-3.0.4/lib/builder/xmlbase.rb:170
tag! at c:/jruby-1.7.2/lib/ruby/gems/shared/gems/builder-3.0.4/lib/builder/xmlbase.rb:63
method_missing at c:/jruby-1.7.2/lib/ruby/gems/shared/gems/builder-3.0.4/lib/builder/xmlbase.rb:88
build_test_suite at c:/jruby-1.7.2/lib/ruby/gems/shared/gems/yarjuf-1.0.5/lib/yarjuf.rb:81
build_all_suites at c:/jruby-1.7.2/lib/ruby/gems/shared/gems/yarjuf-1.0.5/lib/yarjuf.rb:73
each at org/jruby/RubyHash.java:1257
build_all_suites at c:/jruby-1.7.2/lib/ruby/gems/shared/gems/yarjuf-1.0.5/lib/yarjuf.rb:72
build_results at c:/jruby-1.7.2/lib/ruby/gems/shared/gems/yarjuf-1.0.5/lib/yarjuf.rb:67
call at org/jruby/RubyProc.java:249
_nested_structures at c:/jruby-1.7.2/lib/ruby/gems/shared/gems/builder-3.0.4/lib/builder/xmlbase.rb:170
tag! at c:/jruby-1.7.2/lib/ruby/gems/shared/gems/builder-3.0.4/lib/builder/xmlbase.rb:63
method_missing at c:/jruby-1.7.2/lib/ruby/gems/shared/gems/builder-3.0.4/lib/builder/xmlbase.rb:88
build_results at c:/jruby-1.7.2/lib/ruby/gems/shared/gems/yarjuf-1.0.5/lib/yarjuf.rb:66
dump_summary at c:/jruby-1.7.2/lib/ruby/gems/shared/gems/yarjuf-1.0.5/lib/yarjuf.rb:29
__send__ at org/jruby/RubyBasicObject.java:1686
send at org/jruby/RubyKernel.java:2098
notify at c:/jruby-1.7.2/lib/ruby/gems/shared/gems/rspec-core-2.12.0/lib/rspec/core/reporter.rb:98
each at org/jruby/RubyArray.java:1613
notify at c:/jruby-1.7.2/lib/ruby/gems/shared/gems/rspec-core-2.12.0/lib/rspec/core/reporter.rb:97
finish at c:/jruby-1.7.2/lib/ruby/gems/shared/gems/rspec-core-2.12.0/lib/rspec/core/reporter.rb:82
report at c:/jruby-1.7.2/lib/ruby/gems/shared/gems/rspec-core-2.12.0/lib/rspec/core/reporter.rb:36
run at c:/jruby-1.7.2/lib/ruby/gems/shared/gems/rspec-core-2.12.0/lib/rspec/core/command_line.rb:25
run at c:/jruby-1.7.2/lib/ruby/gems/shared/gems/rspec-core-2.12.0/lib/rspec/core/runner.rb:69
autorun at c:/jruby-1.7.2/lib/ruby/gems/shared/gems/rspec-core-2.12.0/lib/rspec/core/runner.rb:8
The Gemfile I am using:
source 'https://rubygems.org'
gem 'rails', '3.2.11'
gem 'active_attr'
gem 'rake', '10.0.2'
gem 'activerecord-jdbcsqlite3-adapter'
gem 'activerecord-jdbcpostgresql-adapter'
gem 'haml'
gem 'nokogiri'
gem 'dynamic_form'
gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'anjlab-bootstrap-rails', '>= 2.1', require: 'bootstrap-rails'
group :development, :test do
gem 'rspec-rails'
gem 'capybara'
gem 'database_cleaner'
gem 'quiet_assets' #https://github.com/evrone/quiet_assets
gem 'factory_girl'
gem 'shoulda'
gem 'yarjuf'
end
group :test do
gem 'cucumber-rails', require: false
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'therubyrhino'
gem 'uglifier', '>= 1.0.3'
end
rspec 3 has a new formatter api and yarjuf doesn't work with it. Can we make changes to yarjuf to make it support rspec 3?
Running rspec -f JUnit
leads to the following for failing tests.
/Library/Ruby/Gems/1.8/gems/rspec-core-2.12.0/lib/rspec/core/formatters/helpers.rb:8:in format_backtrace': undefined method
[]' for #RSpec::Core::Example:0x1076102f8 (NoMethodError)
from /Library/Ruby/Gems/1.8/gems/yarjuf-1.0/lib/yarjuf.rb:45:in `failure_details_for'
This didn't happen against rspec 2.11, but does against 2.12. Joy.
Looks like yarjuf depends on 'builder' but doesn't declare it in the Gemfile.
Cheers,
Dan / broquaint
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.