-
Notifications
You must be signed in to change notification settings - Fork 552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merging parallel test results #350
Comments
Have you looked at issues such as
I don't know what you've tried, but I think you should be using a e.g. # Use multiple 'command_names' to differentiate reports being merged in together
command_name "rails_app_#{$$}" # $$ is the processid
merge_timeout 3600 # 1 hour otherwise you might want to write your own formatter and post-process the output. |
Hi Ben Thanks very much for your response. I don't think that I am fully 'getting' the command_name thing. After However, #219 looks to be exactly what I am looking for and I hadn't Trying this the #219 approach will be my next step anyway.... Cheers Craig On Sat, Nov 15, 2014 at 8:12 PM, Benjamin Fleischer <
|
|
If you use |
Thanks for the info. If you use the command_name approach therefore, am I right in thinking that On Sun, Nov 16, 2014 at 3:08 PM, Joseph Shraibman notifications@github.com
|
@kramerdog No, the whole point of giving each process a different name is to reconcile them for one report. Checks the docs for 'merge_timeout' |
@kramerdog is this still an issue? |
Closing due to lack of activity. Feel free to reopen with new info |
I am running into this same issue with parallel tests now. How was this resolved @josephks ? |
Please give some more context as to what exactly the issue you are running
into is, and how the answers suggested in this thread do not solve the
problem. Thanks!
|
Sure thing, here is an example of running the specs without parallel.
Here is an example of the numbers after a parallel run
|
I removed a good portion of the warnings, however, you can see the coverage is ~ 77% on the first run, and averages much lower on the second. Thoughts on how to make this report a cumulative average? |
The section in the readme about command_name should have you covered, you
will need to identify the distinct test suite runs by number:
https://github.com/colszowka/simplecov/blob/master/README.md#test-suite-names
|
If anyone else comes across this post, this is how we fixed it... # NOTE: Example Build from research below...
# https://github.com/colszowka/simplecov/issues/64
# https://github.com/increments/simplecov-parallel
# https://github.com/increments/simplecov-parallel/blob/master/spec/spec_helper.rb
require 'simplecov/parallel'
SimpleCov::Parallel.activate
SimpleCov.merge_timeout 3600
SimpleCov.minimum_coverage 85
SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new([
SimpleCov::Formatter::HTMLFormatter
])
SimpleCov.start do
coverage_dir 'tmp/coverage'
add_filter '/.bundle/'
add_filter '/spec/'
add_filter '/config/initializers'
add_filter '/docs/'
add_group 'Config', 'config'
add_group 'Controllers', 'app/controllers'
add_group 'Helpers', 'app/helpers'
add_group 'Ignored Code' do |src_file|
File.readlines(src_file.filename).grep(/:nocov:/).any?
end
add_group 'Integrations', 'lib/integration'
add_group 'Lib', 'lib'
add_group "Long Files" do |src_file|
src_file.lines.count > 300
end
add_group 'Models', 'app/models'
add_group 'Modules', 'lib/modules'
add_group 'Providers', 'lib/provider'
add_group 'Serializers', 'app/serializers'
end
if ENV['CODECLIMATE_REPO_TOKEN']
require 'codeclimate-test-reporter'
CodeClimate::TestReporter.start
end We used https://github.com/increments/simplecov-parallel gem. |
@chrishough sounds like the problem was that you're on CircleCI which doesn't have a shared file system between nodes. Thanks for the gem reference. I haven't seen it before. Implementation looks nice. |
We are using Jenkins actually. Do you want me to setup a PR for this for the docs here for other people too? |
a PR would be a good place to discuss, if nothing else see discussion in #558 (comment) |
@chrishough this is weird. Is the build running within a single JenkinsCI worker/server? We are doing just this at work and have no problem with the coverage whatsoever as each one has their own work space and they are on the same file system writing to the JSON file usually works just fine :) |
@PragTob what is your config setup? I tried a number of the options posted in the readme. Only the gem I posted worked correctly. Thoughts? |
@chrishough well we have a fairly standard setup. Jenkins wise it's just a server that ahs workers which will eventually execute our build script which calls .simplecov is roughly this:
We then define the correct command names in spec_helper/env.rb like: `
Now that I see it we should probably use |
@PragTob interesting, we are not using those other commands. As a followup question have you ever encountered missing files in the simplecov report after setting up parallel execution? |
@chrishough the dommand names are pretty important for making parallel tests work correctly. Sure We have encountered missing files, due to various reasons, some of them being dependencies that hardcore |
@PragTob are you or is anyone here working with Code Climate? Have you gotten your test results to show up accurately there ? |
This is less of an issue and more of a request for guidance...
I have seen other threads on parallel testing and merging results etc such as
#147
but none of them seem to quite address the same situation.
I have a Rails 4.1.6 app with SImpleCov 0.9.1 which I am testing using Cucumber and Capybara
Because of the size of the test suite we have developed a parallel test runner which does the following:
In effect therefore each feature is executed as a separate 'test run', each of which, under normal circumstances generates its own coverage report just for that feature.
I think that, with a suitable merge_timeout setting, at least all of the output for the same worker process would be 'auto-merged'?
Of course in reality I am looking for a single coverage report across the entire test suite and am looking for tips on how to do this.
The main challenges are:
Anyway, any suggestions would be much appreciated. Thanks.
The text was updated successfully, but these errors were encountered: