Fix message displayed when running tests

Used to show Deploy FAILURE for successful test runs
Small bump of version too
This commit is contained in:
ViViDboarder 2013-08-21 16:28:46 -07:00
parent 2dd2d50781
commit 3e21b34664
2 changed files with 47 additions and 39 deletions

View File

@ -106,55 +106,63 @@ module AbuseTheForce
result = job.result result = job.result
if result != nil if result != nil
puts "\nDeploy #{result.success ? "SUCCESS" : "FAILURE"}" # Check if this was a test execution
if result.run_test_result != nil
# If a failed deploy, print errors # Display a quick Success or Failure
if result.success == false puts "\nTests #{result.run_test_result.num_failures == "0" ? "SUCCESS" : "FAILURE"}"
# Need messages in an array # Display overview of number of successes and failures
unless result.messages.kind_of? Array puts "TESTS RUN: #{result.run_test_result.num_tests_run} FAILURES: #{result.run_test_result.num_failures}"
result.messages = [].push result.messages
end
puts "DEPLOY ERRORS: #{result.messages.reject { |m| m.success }.size}" if result.run_test_result.failures != nil
result.messages.each do |m| # Make sure failures is an array
unless result.run_test_result.failures.kind_of? Array
# If the path is not from the project, fix it result.run_test_result.failures = [].push result.run_test_result.failures
unless m.file_name.starts_with? Atf_Config.src
m.file_name = m.file_name.sub(/[a-zA-Z._-]*\//, Atf_Config.src + '/')
end end
# Print our error in teh format "filename:line:column type in object message" result.run_test_result.failures.each do |m|
if !m.success
puts "#{m.file_name}:#{m.line_number}:#{m.column_number} #{m.problem_type} in #{m.full_name} #{m.problem}" # Print our error in teh format "filename:line:column type in object message"
if !m.success
puts "#{m.name}.#{m.method_name}: #{m.message}"
puts "Stack Trace: #{m.stack_trace}"
puts ""
end # not success
end # loop through test faiulres
end # failures != nil
else # run_test_result != nil
puts "\nDeploy #{result.success ? "SUCCESS" : "FAILURE"}"
# Not a test execution, so deployment
# If a failed deploy, print errors
if result.success == false
# Need messages in an array
unless result.messages.kind_of? Array
result.messages = [].push result.messages
end end
end
# Need messages in an array puts "DEPLOY ERRORS: #{result.messages.reject { |m| m.success }.size}"
if result.run_test_result != nil
puts "TESTS RUN: #{result.run_test_result.num_tests_run} FAILURES: #{result.run_test_result.num_failures}" result.messages.each do |m|
if result.run_test_result.failures != nil # If the path is not from the project, fix it
unless m.file_name.starts_with? Atf_Config.src
unless result.run_test_result.failures.kind_of? Array m.file_name = m.file_name.sub(/[a-zA-Z._-]*\//, Atf_Config.src + '/')
result.run_test_result.failures = [].push result.run_test_result.failures
end end
result.run_test_result.failures.each do |m| # Print our error in teh format "filename:line:column type in object message"
if !m.success
# Print our error in teh format "filename:line:column type in object message" puts "#{m.file_name}:#{m.line_number}:#{m.column_number} #{m.problem_type} in #{m.full_name} #{m.problem}"
if !m.success
puts "#{m.name}.#{m.method_name}: #{m.message}"
puts "Stack Trace: #{m.stack_trace}"
puts ""
end
end end
end end
end end # success == false
end end # end result.run_test_result != null else
end end # result != nil
}. }.
on_error { |job| puts "Something bad happened!" }. on_error { |job| puts "Something bad happened!" }.
on_poll { |job| puts "Polling for #{job.id}!" }. on_poll { |job| puts "Polling for #{job.id}!" }.

View File

@ -1,3 +1,3 @@
module AbuseTheForce module AbuseTheForce
VERSION = '0.1.2' VERSION = '0.1.3'
end end