Skip to content
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

Add MSDN url for each test in html report #259

Merged
merged 3 commits into from
Oct 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/engines/hcktest/playlist.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,18 @@ def initialize(client, project, target, tools, kit)
# A custom ListTests error exception
class ListTestsError < AutoHCKError; end

def info_page_url(test)
# TODO: Add check that URL returns 200 (OK), not 404 (Not Found)
"https://docs.microsoft.com/en-us/windows-hardware/test/hlk/testref/#{test['id']}"
end

def list_tests(log)
@tests = @tools.list_tests(@target['key'], @machine, @project.engine.tag,
@playlist)
raise ListTestsError, 'Failed to list tests' unless @tests

@tests.each { |t| t['url'] = info_page_url(t) }

custom_select_test_names(log)
custom_reject_test_names(log)
sort_by_duration
Expand Down
7 changes: 1 addition & 6 deletions lib/engines/hcktest/tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,6 @@ def done_tests
@tests.select { |test| test_finished?(test) }
end

def info_page(test)
url = 'https://docs.microsoft.com/en-us/windows-hardware/test/hlk/testref/'
"Test information page: #{url}#{test['id']}"
end

def on_test_start(test)
@logger.info(">>> Currently running: #{test['name']} [#{test['estimatedruntime']}]")

Expand All @@ -200,7 +195,7 @@ def print_tests_stats
def print_test_results(test)
results = @tests.find { |t| t['id'] == test['id'] }
@logger.info("#{results['status']}: #{test['name']}")
@logger.info(info_page(test))
@logger.info("Test information page: #{test['url']}")
end

def archive_test_results(test)
Expand Down
12 changes: 10 additions & 2 deletions lib/templates/report.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@
<tr class="table-secondary">
<% end %>
<th scope="row"><%= idx + 1 %></th>
<td><%= test['name'] %></td>
<td>
<% unless test['url'].nil? %><a href="<%= test['url'] %>"><% end %>
<%= test['name'] %>
<% unless test['url'].nil? %></a><% end %>
</td>
<td><%= test['estimatedruntime'] %></td>
<td><%= test['status'] %></td>
</tr>
Expand All @@ -65,7 +69,11 @@
<% rejected_test.each_with_index do |test, idx| %>
<tr class="table-warning">
<th scope="row"><%= tests.length + idx + 1 %></th>
<td><%= test['name'] %></td>
<td>
<% unless test['url'].nil? %><a href="<%= test['url'] %>"><% end %>
<%= test['name'] %>
<% unless test['url'].nil? %></a><% end %>
</td>
<td><%= test['estimatedruntime'] %></td>
<td>Skipped</td>
</tr>
Expand Down