Skip to content

Commit

Permalink
Add a column to the Inferno Tests in the procedure matrix showing rel…
Browse files Browse the repository at this point in the history
…evant test option.
  • Loading branch information
arscan committed Aug 16, 2023
1 parent a4e12e0 commit fc4985e
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions lib/onc_certification_g10_test_kit/tasks/generate_matrix.rb
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,17 @@ def generate_test_procedure_worksheet # rubocop:disable Metrics/CyclomaticComple
end
end

# returns an array of options that apply to this test or group
def applicable_options(runnable)

runnable_and_parents = [runnable].tap do |parents|
while runnable.respond_to?(:parent) && runnable.respond_to?(:suite_option_requirements) && (runnable = runnable.parent)
parents << runnable
end
end
runnable_and_parents.map(&:suite_option_requirements).compact.flatten
end

def generate_inferno_test_worksheet # rubocop:disable Metrics/CyclomaticComplexity
workbook.add_worksheet('Inferno Tests')
inferno_worksheet = workbook.worksheets[2]
Expand All @@ -207,7 +218,11 @@ def generate_inferno_test_worksheet # rubocop:disable Metrics/CyclomaticComplexi
.min || 0
description.lines.map { |l| l[natural_indent..] || "\n" }.join.strip
end],
['Test Procedure Steps', 30, ->(test) { inferno_to_procedure_map[test.short_id].join(', ') }]
['Test Procedure Steps', 30, ->(test) { inferno_to_procedure_map[test.short_id].join(', ') }],
['Standard Version Filter', 30, lambda do |test|
applicable_options(test).map(&:value).uniq.join(', ')
end]

]

columns.each_with_index do |row_name, index|
Expand All @@ -218,10 +233,13 @@ def generate_inferno_test_worksheet # rubocop:disable Metrics/CyclomaticComplexi

test_suite.groups.each do |group|
row += 1
inferno_worksheet.add_cell(row, 0, group.title)
inferno_worksheet.add_cell(row, 0, "#{group.short_id}: #{group.title}")
inferno_worksheet.add_cell(row, 6, applicable_options(group).map(&:value).uniq.join(', '))
row += 1
group.groups.each do |test_case|
inferno_worksheet.add_cell(row, 1, "#{test_case.short_id}: #{test_case.title}")
inferno_worksheet.add_cell(row, 6, applicable_options(test_case).map(&:value).uniq.join(', '))

row += 1
test_case.tests.each do |test|
this_row = columns.map do |column|
Expand Down

0 comments on commit fc4985e

Please sign in to comment.