ci_reporter | popular test frameworks that allows you to generate XML | Unit Testing library
kandi X-RAY | ci_reporter Summary
Support
Quality
Security
License
Reuse
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample Here
ci_reporter Key Features
ci_reporter Examples and Code Snippets
Trending Discussions on ci_reporter
Trending Discussions on ci_reporter
QUESTION
The ci_reporter_minitest gem was very helpful for this when the rake binary was the command to use to start the test runner. I want to use the rails binary vs the rake binary for rails 6.
I'm open to other solutions not using ci_reporter.
I'm failing to get the ci_reporter_minitest gem to work with the rails binary that kicks off running minitest for rails 6. Also, I haven't succeeded yet in finding any posts or questions referencing this problem.
I looked into just using the rake binary for the ci server, but didn't find a working approach there either.
Here's a config I tried that does run the ci:setup task (removing any previous test/report directory) and does run the tests, but doesn't generate the xml output. I did have this working fine with rails 4.2
#lib/tasks/test_tasks.rake
require 'ci/reporter/rake/minitest'
task :minitest => 'ci:setup:minitest'
namespace :test do
task :something => 'test:prepare' do
$: << "test"
Rake::Task['ci:setup:minitest'].invoke
test_files=FileList['test/models/something.rb']
Rails::TestUnit::Runner.run(test_files)
end
end
$> bundle exec rails test:something
ANSWER
Answered 2020-Nov-03 at 00:26I did have success switching to minitest-reporters gem.
QUESTION
I have a tool that analyze some ruby projects having Gemfile and Gemfile.lock files. This tool given in input the path where ruby project is, list all its dependencies.
My problem is that I only need to print production dependencies excluding development and test. Today I find out that my code does not exclude them and I do not know how to modify it for my purpose. How I can remove development and test dependencies from the list?
Here a simplified version of the ruby code I use to list dependencies:
project_path = ARGV.map {|path| File.expand_path(path) }
ENV['BUNDLE_GEMFILE'] = project_path+"/Gemfile"
lockfile_path=project_path+"/Gemfile.lock"
lockfile_contents = File.read(lockfile_path)
parser = Bundler::LockfileParser.new(lockfile_contents)
lockfile_contents = File.read(lockfile_path)
parser = Bundler::LockfileParser.new(lockfile_contents)
to_fetch = []
parser.specs.each do |spec|
gem_basename = "#{spec.name},#{spec.version}"
to_fetch << gem_basename
end
to_fetch.uniq!
to_fetch.sort!
The variable to_fetch contains the dependencies.
Here the Gemfile:
source "https://rubygems.org"
gem "cf-message-bus", git: "https://github.com/cloudfoundry/cf-message-bus.git"
gem "vcap_common", git: "https://github.com/cloudfoundry/vcap-common.git"
gem "aws-sdk", '~> 2', require: false
gem "steno"
gem "httparty"
group :test do
gem 'codeclimate-test-reporter', require: false
gem "rake"
gem "rspec"
gem "ci_reporter"
gem "timecop"
gem "webmock"
end
Let me know if you need also the Gemfile.lock that is 149 lines long.
ANSWER
Answered 2017-Jun-21 at 21:05How about this
require 'bundler'
dependencies = Bundler::Definition.build('Gemfile','Gemfile.lock',nil).
dependencies.each_with_object(Hash.new { |h,k| h[k] = [] }) do |dep,obj|
dep.groups.each do |g|
obj[g] << {name: dep.name,
required_version: dep.requirement.requirements.join,
actual_version: dep.to_spec.version.to_s
}
end
end
This will group all the dependencies by their group and place them in Hash
es containing their name, their required version and their specific version. For example:
{:default=>
[{:name=>"rake", :required_version=>"=11.3.0", :actual_version=>"11.3.0"},
{:name=>"rails", :required_version=>"=4.2.5.2", :actual_version=>"4.2.5.2"},
{:name=>"arel", :required_version=>"=6.0.3", :actual_version=>"6.0.3"},
{:name=>"activerecord",
:required_version=>"~>4.2.0",
:actual_version=>"4.2.8"},
{:name=>"activerecord-sqlserver-adapter",
:required_version=>"~>4.2.0",
:actual_version=>"4.2.18"},
{:name=>"tiny_tds", :required_version=>"~>0.7.0", :actual_version=>"0.7.0"}],
:doc=>
[{:name=>"sdoc", :required_version=>"~>0.4.0", :actual_version=>"0.4.2"}],
:development=>
[{:name=>"byebug", :required_version=>">=0", :actual_version=>"9.0.6"},
{:name=>"web-console",
:required_version=>"~>2.0",
:actual_version=>"2.3.0"},
{:name=>"capistrano",
:required_version=>"=3.7.2",
:actual_version=>"3.7.2"}],
:test=>
[{:name=>"byebug", :required_version=>">=0", :actual_version=>"9.0.6"}]}
BTW :default
is production (might need to expand further to handle dependencies of dependencies I will see what I can do)
Update 1: Similar formatting lists :runtime
dependencies of dependencies (not uniq)
def dep_to_hash(dep)
{name: dep.name,
required_version: dep.requirement.requirements.join,
actual_version: dep.to_spec.version.to_s,
dependencies: dep.to_spec.dependencies.select {|d| d.type == :runtime}.each_with_object(Hash.new { |h,k| h[k] = [] }) do |dep2,obj|
obj[dep2.type] << dep_to_hash(dep2)
end
}
end
deps = Bundler::Definition.build('Gemfile','Gemfile.lock',nil).
dependencies.each_with_object(Hash.new { |h,k| h[k] = [] }) do |dep,obj|
dep.groups.each do |g|
obj[g] << dep_to_hash(dep)
end
end
Output snippet:
{:default=>
[{:name=>"rails",
:required_version=>"=4.2.5.2",
:actual_version=>"4.2.5.2",
:dependencies=>
{:runtime=>
[{:name=>"activesupport",
:required_version=>"=4.2.5.2",
:actual_version=>"4.2.5.2",
:dependencies=>
{:runtime=>
[{:name=>"i18n",
:required_version=>"~>0.7",
:actual_version=>"0.8.1",
:dependencies=>{}},
{:name=>"json",
:required_version=>">=1.7.7~>1.7",
:actual_version=>"1.8.6",
:dependencies=>{}},
Update 2 (More like what you seem to be targeting now and is uniq by "group")
require 'bundler'
def add_to_dep(dep,top_level)
deps = dep.to_spec.dependencies.select {|d| d.type == :runtime}
deps.each do |dep|
add_to_dep(dep,top_level)
end
# handle existing dependencies by using highest version
exists = top_level.grep(/#{dep.name}/)[0]
if exists
version = exists.split(',').last
new_version = dep.to_spec.version.to_s
if new_version > version
top_level.delete_at(top_level.index(exists))
top_level << "#{dep.name}, #{dep.to_spec.version}"
end
else
top_level << "#{dep.name}, #{dep.to_spec.version}"
end
end
deps = Bundler::Definition.build('Gemfile','Gemfile.lock',nil).
dependencies.each_with_object(Hash.new { |h,k| h[k] = [] }) do |dep,obj|
dep.groups.each do |g|
add_to_dep(dep,obj[g])
end
end.each {|_k,v| v.sort!}
Output Snippet:
{:default=>
["actionmailer, 4.2.5.2",
"actionpack, 4.2.8",
"actionview, 4.2.8",
"activejob, 4.2.5.2",
"activemodel, 4.2.8",
"activerecord, 4.2.8",
"activerecord-sqlserver-adapter, 4.2.18",
"activesupport, 4.2.8",
"arel, 6.0.4",
"axlsx, 2.0.1",
"builder, 3.2.3",
"bundler, 1.14.6",
"coffee-rails, 4.1.1",
"coffee-script, 2.4.1",
"coffee-script-source, 1.12.2",
"concurrent-ruby, 1.0.5",
"erubis, 2.7.0",
"execjs, 2.7.0",
"globalid, 0.4.0",
"hash-deep-merge, 0.1.1",
"htmlentities, 4.3.4",
"i18n, 0.8.1",
"jbuilder, 2.6.2",
"jquery-rails, 4.2.2",
"jquery-ui-rails, 6.0.1",
"json, 1.8.6",
"lazy_high_charts, 1.5.6",
"loofah, 2.0.3",
"mail, 2.6.5",
"mime-types, 3.1",
"mime-types-data, 3.2016.0521",
QUESTION
I have a puppet module project that fails when trying to update Gems, although it works in some computers. The Gems are used for the spec tests of the module.
Here's the command I run and the output:
X:\puppet-module-rems>gem install -g Gemfile -f
ERROR: While executing gem ... (Gem::UnsatisfiableDependencyError)
Unable to resolve dependency: user requested 'win32-service (= 0.8.7)'
The gem that it's trying to install/update is already in the system:
X:\puppet-module-rems>gem list -l
*** LOCAL GEMS ***
ast (2.3.0)
bigdecimal (1.2.4)
builder (3.2.2)
bundler (1.13.0.rc.2)
childprocess (0.5.9)
ci_reporter (2.0.0)
ci_reporter_rspec (1.0.0)
deep_merge (1.0.1)
diff-lcs (1.2.5)
facter (2.4.6 x64-mingw32)
ffi (1.9.14 x64-mingw32, 1.9.6 x64-mingw32)
ffi-win32-extensions (1.0.3)
hiera (1.3.4)
hiera-eyaml (2.1.0)
highline (1.6.21)
io-console (0.4.3, 0.4.2)
json (1.8.1)
json_pure (2.0.2)
metaclass (0.0.4)
minitar (0.5.4)
minitest (4.7.5)
mocha (1.1.0)
multi_json (1.12.1)
multi_test (0.1.2)
parser (2.3.1.2)
powerpack (0.1.1)
psych (2.0.5)
ptools (1.3.3 universal-mingw32)
puppet (3.8.1 x64-mingw32)
puppet-lint (2.0.2)
puppet-syntax (2.1.0)
puppetlabs_spec_helper (1.1.1)
rainbow (2.1.0)
rake (10.1.0)
rdoc (4.1.0)
rspec (3.5.0, 3.5.0.beta2)
rspec-core (3.5.2, 3.5.0.beta2)
rspec-expectations (3.5.0, 3.5.0.beta2)
rspec-mocks (3.5.0, 3.5.0.beta2)
rspec-puppet (2.4.0, 2.3.2)
rspec-support (3.5.0, 3.5.0.beta2)
rubocop (0.42.0)
ruby-progressbar (1.8.1)
stomp (1.3.3)
sys-admin (1.6.4)
test-unit (2.5.5, 2.1.7.0, 2.1.6.0, 2.1.5.0)
thread_order (1.1.0)
trollop (2.1.2)
unicode-display_width (1.1.0)
win32-dir (0.4.9)
win32-eventlog (0.6.6, 0.6.2)
win32-file (0.8.1)
win32-file-stat (1.5.5)
win32-process (0.7.5, 0.7.4)
win32-security (0.2.5)
win32-service (0.8.7, 0.8.6)
Here's the version of ruby I have:
X:\puppet-module-rems>ruby --version
ruby 2.1.7p400 (2015-08-18 revision 51632) [x64-mingw32]
EDITED #1
Here's the content of the Gemfile:
source 'https://rubygems.org'
puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['3.8.1']
gem 'puppet', puppetversion
gem 'puppetlabs_spec_helper', '= 1.1.1'
gem 'puppet-lint', '>= 0.3.2'
gem 'facter', '>= 1.7.0'
gem 'ci_reporter_rspec'
gem 'win32-service', '= 0.8.7'
gem 'rake', '= 10.1.0'
gem 'rspec-core', '= 3.5.2'
gem 'rspec-expectations', '= 3.5.0'
gem 'rspec-mocks', '= 3.5.0'
gem 'rspec-puppet', '= 2.4.0'
gem 'rspec-support', '= 3.5.0'
ANSWER
Answered 2017-Jan-04 at 17:30So, after further research, I found that the problem was not related to my code, files or configuration but with a problem with Rubygems.
Bottomline, I had to follow this link and manually update the certificate.
It looks like ruby wasn't able to connect to the server to check for dependencies of the gems I was requiring.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ci_reporter
Add the "Publish JUnit test result report" post-build step in the job configuration.
Enter "test/reports/*.xml,spec/reports/*.xml" in the "Test report XMLs" field (adjust this to suit which tests you are running)
Support
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesExplore Kits - Develop, implement, customize Projects, Custom Functions and Applications with kandi kits
Save this library and start creating your kit
Share this Page