NIHVIVO-76 In the build, break the acceptance tests into 2 steps: running and collating. And between the steps, fail if we find the word Error or Exception in the output from selenium/ruby.
This commit is contained in:
parent
31ebff72fd
commit
5520c5be0a
5 changed files with 63 additions and 14 deletions
16
build.xml
16
build.xml
|
@ -65,13 +65,27 @@
|
|||
</condition>
|
||||
</fail>
|
||||
|
||||
<property name="acceptance.script.directory" location="utilities/acceptance-tests/script"/>
|
||||
<property name="acceptance.script.directory" location="utilities/acceptance-tests/script" />
|
||||
|
||||
<exec executable="ruby" dir="${acceptance.script.directory}" failonerror="true">
|
||||
<arg value="run_acceptance_tests.rb" />
|
||||
<arg value="${acceptance.properties.file}" />
|
||||
<redirector outputproperty="acceptance.test.output" alwayslog="true" />
|
||||
</exec>
|
||||
|
||||
<fail message="Errors were detected in the console output from the acceptance tests.">
|
||||
<condition>
|
||||
<or>
|
||||
<contains string="${acceptance.test.output}"
|
||||
substring="error"
|
||||
casesensitive="false" />
|
||||
<contains string="${acceptance.test.output}"
|
||||
substring="exception"
|
||||
casesensitive="false" />
|
||||
</or>
|
||||
</condition>
|
||||
</fail>
|
||||
|
||||
<exec executable="ruby" dir="${acceptance.script.directory}" failonerror="true">
|
||||
<arg value="output_manager.rb" />
|
||||
<arg value="${acceptance.properties.file}" />
|
||||
|
|
|
@ -30,6 +30,7 @@ require 'date'
|
|||
require 'fileutils'
|
||||
require File.expand_path('output_suite_parser', File.dirname(File.expand_path(__FILE__)))
|
||||
require File.expand_path('output_summary_formatter', File.dirname(File.expand_path(__FILE__)))
|
||||
require File.expand_path('property_file_reader', File.dirname(File.expand_path(__FILE__)))
|
||||
|
||||
class TestInfo
|
||||
attr :test_name, true
|
||||
|
@ -148,19 +149,24 @@ class OutputManager
|
|||
sanity_checks_on_parameters()
|
||||
|
||||
@log_file = File.expand_path("log_file.txt", @output_directory)
|
||||
FileUtils::remove_file(@log_file) if File.exist?(@log_file)
|
||||
|
||||
@output_summary_file = File.expand_path("index.html", @output_directory)
|
||||
@output_summary_file = File.expand_path("summary.html", @output_directory)
|
||||
FileUtils::remove_file(@output_summary_file) if File.exist?(@output_summary_file)
|
||||
|
||||
@ignored_tests = load_list_of_ignored_tests()
|
||||
end
|
||||
|
||||
# Start with an empty log file.
|
||||
#
|
||||
def empty_log()
|
||||
FileUtils::remove_file(@log_file) if File.exist?(@log_file)
|
||||
end
|
||||
|
||||
# Write a message to the log file
|
||||
#
|
||||
def log(level, message)
|
||||
File.open(@log_file, File::CREAT | File::APPEND | File::WRONLY) do |f|
|
||||
f.print("#{level} #{message}\n")
|
||||
f.print("#{DateTime.now.strftime('%Y/%m/%d %H:%M:%S')} #{level} #{message}\n")
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -191,13 +197,43 @@ class OutputManager
|
|||
# This is the big one -- produce the output summary.
|
||||
#
|
||||
def summarize()
|
||||
log("INFO ", "Parsing test output")
|
||||
@osp = OutputSuiteParser.new(self, @log_file)
|
||||
@osp.parse()
|
||||
|
||||
log("INFO ", "Copying CSS file to output directory")
|
||||
copy_css_file()
|
||||
|
||||
log("INFO ", "Producing summary file")
|
||||
File.open(@output_summary_file, File::CREAT | File::WRONLY) do |f|
|
||||
osf = OutputSummaryFormatter.new(@osp, @log_file)
|
||||
osf.format(f)
|
||||
end
|
||||
|
||||
log("INFO ", "Summary complete")
|
||||
end
|
||||
end
|
||||
|
||||
#
|
||||
#
|
||||
# ------------------------------------------------------------------------------------
|
||||
# Standalone calling.
|
||||
#
|
||||
# Do this if this program was called from the command line. That is, if the command
|
||||
# expands to the path of this file.
|
||||
# ------------------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
if File.expand_path($0) == File.expand_path(__FILE__)
|
||||
if ARGV.length == 0
|
||||
raise("No arguments - usage is: ruby output_manager.rb <properties_file>")
|
||||
end
|
||||
if !File.file?(ARGV[0])
|
||||
raise "File does not exist: '#{ARGV[0]}'."
|
||||
end
|
||||
|
||||
properties = PropertyFileReader.read(ARGV[0])
|
||||
|
||||
om = OutputManager.new(properties)
|
||||
om.summarize()
|
||||
end
|
||||
|
|
|
@ -8,6 +8,8 @@ Parameters:
|
|||
--------------------------------------------------------------------------------
|
||||
=end
|
||||
require 'date'
|
||||
# This one is needed to get Time.parse() ????? Go figure.
|
||||
require 'open-uri'
|
||||
|
||||
class OutputSuiteParser
|
||||
attr :errors
|
||||
|
|
|
@ -170,7 +170,7 @@ END_STATS
|
|||
|
||||
if ignores.empty?
|
||||
f.print " <tr>\n"
|
||||
f.print " <td colspan=\"2\">No tests ignored.</td>\n"
|
||||
f.print " <td colspan=\"3\">No tests ignored.</td>\n"
|
||||
f.print " </tr>\n"
|
||||
else
|
||||
ignores.each do |t|
|
||||
|
|
|
@ -205,10 +205,6 @@ class AcceptanceRunner
|
|||
@output_manager.log("ERROR", message)
|
||||
end
|
||||
|
||||
def create_summary_html()
|
||||
@output_manager.summarize()
|
||||
end
|
||||
|
||||
# ------------------------------------------------------------------------------------
|
||||
public
|
||||
# ------------------------------------------------------------------------------------
|
||||
|
@ -226,14 +222,15 @@ class AcceptanceRunner
|
|||
sanity_checks_on_parameters()
|
||||
|
||||
@database_cleanser = DatabaseCleanser.new(properties)
|
||||
@output_manager = OutputManager.new(properties)
|
||||
|
||||
@output_manager = OutputManager.new(properties)
|
||||
@output_manager.empty_log()
|
||||
end
|
||||
|
||||
# Run all of the test suites and produce an output summary page.
|
||||
# Run all of the test suites
|
||||
def run
|
||||
run_all_suites()
|
||||
create_summary_html()
|
||||
# To collate the output from the suites, use OutputManager.new(properties).summarize()
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue