-
Notifications
You must be signed in to change notification settings - Fork 95
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
Merge reports feature #34
Comments
What's the use case? You would like to run just part of your test suite and record for it the time execution. Then merge the result with the existing report. Currently, you generate the report with time execution for all tests on your CI with command like:
and you'd like to do something like
The output of this command will contain time execution for models specs. The existing knapsack report file will be merged with the report for models specs. Caution: You should avoid generating a report with merge feature on your development machine and mixing it with the report generated on CI because performance on your machine and CI server are different so test suite split on CI based on merged knapsack report will be less accurate. Is this a feature you are going to use? You can also try http://knapsackpro.com/ and get a free API key. It will keep your reports up to date on knapsackpro.com server. I'd like to keep knapsack gem simple without too many confusing things. If you are going to prepare PR and info how to use merge report feature then I'm fine to review it. We can also wait and see if anyone would +1 this request and you can in the mean time check knapsackpro gem. |
Right now we're running our build on travis across 5 parallel VMs. So we On Thu, Apr 7, 2016 at 12:30 PM, Artur Trzop notifications@github.com
Jared |
At first, it sounds good but the thing that bothers me is the case when a developer checks in updated knapsack report based on time execution of tests on his machine. The same specs may run different time on different developers' machines or CI servers. When test files have long time execution like feature tests with capybara then this may have a significant impact on the end test suite split result. Do you have the pack you mentioned somewhere? Is it a fork of knapsack gem? |
This is the monkey patch we're using # Monkey Patch Knapsack to merge reports instead of overwrite
begin
class Knapsack::Report
alias_method :save_without_leading_existing_report, :save
def save
Knapsack::Presenter.existing_report = open
save_without_leading_existing_report
end
end
class << Knapsack::Presenter
attr_writer :existing_report
def report_hash
@existing_report.merge(Knapsack.tracker.test_files_with_time).sort.to_h
end
def report_yml
report_hash.to_yaml
end
def report_json
JSON.pretty_generate(report_hash)
end
end
end It doesn't feel like an elegant solution so I didn't bother to PR it. But :D On Mon, Apr 11, 2016 at 2:48 PM, Artur Trzop notifications@github.com
Jared |
@deadlyicon Thanks for sharing this. Maybe someone will try this. You can turn it into gist for instance. For now, I'd like to keep it simple and don't introduce this to knapsack as this solution adds more complexity depend on the use case. Anyway, thank you for letting me know about your idea. |
thank you! feel free to share: On Mon, Apr 11, 2016 at 4:08 PM, Artur Trzop notifications@github.com
Jared |
I've updated FAQ in readme https://github.com/ArturT/knapsack#how-to-update-existing-knapsack-report-for-a-few-test-files |
awesome thanks! On Mon, Apr 11, 2016 at 4:39 PM, Artur Trzop notifications@github.com
Jared |
Are there plans to add a
merge_report
feature so knapsack will update the report file instead of overwriting it?I'd be happy to put together a PR is the feature is wanted :)
The text was updated successfully, but these errors were encountered: