-
Notifications
You must be signed in to change notification settings - Fork 5
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
Fi-1930: Custom Result Rollup #516
Conversation
…pass Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #516 +/- ##
==========================================
+ Coverage 79.66% 79.83% +0.17%
==========================================
Files 249 252 +3
Lines 13179 13305 +126
Branches 1283 1289 +6
==========================================
+ Hits 10499 10622 +123
- Misses 1931 1934 +3
Partials 749 749
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
…pass Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
…mework/inferno-core into fi-1930-custom-result-rollup
…pass Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
…pass Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
…mework/inferno-core into fi-1930-custom-result-rollup
Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
title 'Passing Group' | ||
description 'Criteria: Passes if test 1 passes, or test 2 and test 3 pass' | ||
|
||
customize_passing_result do |results| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is quite there yet.
customize_passing_result
is a confusing name.- This doesn't allow groups to do all of the things with results that tests can do, like add messages and summary messages
- It would be great if assertions and the rest of the test dsl could be used here
What if groups had the option of containing a run
block like tests do, and the results were made available via an attr_accessor
?
Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
lib/inferno/entities/test_group.rb
Outdated
def_delegators 'self.class', :title, :id, :groups, :inputs, :outputs, :tests | ||
def_delegators 'self.class', :title, :id, :block, :groups, :inputs, :outputs, :tests | ||
|
||
attr_accessor :result_message, :child_results |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You think it's worth calling this child_results
rather than just results
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just wanted to add clarity that these are the children's results being used, but I'm totally fine simplifying it to results
since it only handles those anyway.
end | ||
|
||
describe '#each' do | ||
it 'iterates over each result in the collection' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it 'returns...
. You should check the return type of #each
as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to test that it returns the correct thing when it's given a block, also.
Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
expect(result_collection.each).to be_a(Enumerator) | ||
end | ||
|
||
it 'returns the `results` attribute of the collection when a block is given' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#each
typically returns self
, and I think it should here also, so that any further chaining happens on a ResultCollection
rather than an Array
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true!! updated
Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
|
||
parent_instance = parent.new | ||
parent_instance.results << child_results |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this actually tested? This should create a nested array, in contrast to the flat array created above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ResultCollection#<<
flattens the ResultCollection#results
array.
Summary
This PR enhances the result rollup feature to support custom result logic through a user-defined block. The changes include:
ResultCollection
class: manages a collection of Inferno::Entities::Result objectscustomize_passing_result
method that sets/ gets the custom block to define the passing criteria.Inferno::ResultSummarizer
andInferno::TestRunner
: now takes custom result block into account when determining the overall result of a TestGroup or TestSuite.Testing Guidance
Custom Result Suite
and ensure correct behavior