NIHVIVO-76 Add a reason for ignoring each test.

This commit is contained in:
jeb228 2010-03-16 16:36:53 +00:00
parent 786321b54d
commit 27f7fc2e85
4 changed files with 26 additions and 9 deletions

View file

@ -1,2 +0,0 @@
# This test is known to fail, because not all pages come up properly if bookmarked.
user-management, Bookmark Without Logging In

View file

@ -36,6 +36,7 @@ class TestInfo
attr :suite_name, true attr :suite_name, true
attr :output_link, true attr :output_link, true
attr :status, true attr :status, true
attr :reason_for_ignoring, true
end end
class SuiteInfo class SuiteInfo
@ -107,9 +108,14 @@ class OutputManager
line.strip! line.strip!
if line.length == 0 || line[0] == ?# || line[0] == ?! if line.length == 0 || line[0] == ?# || line[0] == ?!
# ignore blank lines, and lines starting with '#' or '!'. # ignore blank lines, and lines starting with '#' or '!'.
elsif line =~ /^([^,]+),([^,]+)$/ elsif line =~ /^([^,#]+),([^,#]+)(\s*#(.*))?$/
# suite name and test name separated by ',' and optional whitespace. # suite name and test name separated by ',' and optional whitespace.
ignored_tests << [$1.strip, $2.strip] # Optional comment on the end of the line, starting with a '#'
if $4 == nil
ignored_tests << [$1.strip, $2.strip, '']
else
ignored_tests << [$1.strip, $2.strip, $4]
end
else else
raise "Invalid line in ignored tests file: '#{line}'" raise "Invalid line in ignored tests file: '#{line}'"
end end
@ -166,12 +172,23 @@ class OutputManager
# Have we decided to ignore this test if it fails? # Have we decided to ignore this test if it fails?
# #
def ignore_test?(suite_name, test_name) def ignore_test?(suite_name, test_name)
@ignored_tests.each do |pair| @ignored_tests.each do |t|
return true if pair[0] == suite_name && pair[1] == test_name return true if t[0] == suite_name && t[1] == test_name
end end
return false return false
end end
# Why are we ignoring this test?
#
def get_reason_for_ignoring(suite_name, test_name)
@ignored_tests.each do |t|
return t[2] if t[0] == suite_name && t[1] == test_name
end
return ''
end
# This is the big one -- produce the output summary.
#
def summarize() def summarize()
@osp = OutputSuiteParser.new(self, @log_file) @osp = OutputSuiteParser.new(self, @log_file)
@osp.parse() @osp.parse()

View file

@ -93,8 +93,9 @@ class OutputSuiteParser
t.output_link = s.output_link + md[2] t.output_link = s.output_link + md[2]
if md[1] == 'status_passed' if md[1] == 'status_passed'
t.status = Status::GOOD t.status = Status::GOOD
elsif @output_manager.ignore_test?(t.suite_name, t.test_name) elsif @output_manager.ignore_test?(t.suite_name, t.test_name)
t.status = Status::FAIR t.status = Status::FAIR
t.reason_for_ignoring = @output_manager.get_reason_for_ignoring(t.suite_name, t.test_name)
else else
t.status = Status::BAD t.status = Status::BAD
end end

View file

@ -55,7 +55,7 @@ class OutputSummaryFormatter
<body> <body>
<div class="heading"> <div class="heading">
Acceptance test results: 3:45 p.m. March 10, 2010 Acceptance test results: #{@osp.start_time}
<div class="#{html_class} one-word">#{status}</div> <div class="#{html_class} one-word">#{status}</div>
</div> </div>
@ -166,7 +166,7 @@ END_STATS
end end
f.print " <div class=section>Ignored tests</div>\n\n <table cellspacing=\"0\">\n" f.print " <div class=section>Ignored tests</div>\n\n <table cellspacing=\"0\">\n"
f.print " <tr><th>Suite name</th><th>Test name</th></tr>\n" f.print " <tr><th>Suite name</th><th>Test name</th><th>Reason for ignoring</th></tr>\n"
if ignores.empty? if ignores.empty?
f.print " <tr>\n" f.print " <tr>\n"
@ -177,6 +177,7 @@ END_STATS
f.print " <tr class=\"#{Status::html_class(t.status)}\">\n" f.print " <tr class=\"#{Status::html_class(t.status)}\">\n"
f.print " <td>#{t.suite_name}</td>\n" f.print " <td>#{t.suite_name}</td>\n"
f.print " <td><a href=\"#{t.output_link}\">#{t.test_name}</a></td>\n" f.print " <td><a href=\"#{t.output_link}\">#{t.test_name}</a></td>\n"
f.print " <td>#{t.reason_for_ignoring}</td>\n"
f.print " </tr>\n" f.print " </tr>\n"
end end
end end