Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Only sets the JUnit alias stuff once

  • Loading branch information...
commit 826582d5190d869d812bd19a497eeac6e1b2deb3 1 parent 3b84ec2
@davetron5000 authored
Showing with 45 additions and 45 deletions.
  1. +45 −2 Rakefile
  2. +0 −43 test/testbase.rb
View
47 Rakefile
@@ -27,8 +27,8 @@ end
{ :test => { :desc => 'Runs Unit Tests', :prefix => 'tc_', :required_file => nil, :coverage => true },
:inttest => { :desc => 'Runs Integration Tests', :prefix => 'int_', :required_file => 'it_cred.rb', :coverage => true },
- #:functest => { :desc => 'Runs Functional Tests', :prefix => 'func_documents', :required_file => 'functest_cred.rb', :coverage => true },
- :functest => { :desc => 'Runs Functional Tests', :prefix => 'func_', :required_file => 'functest_cred.rb', :coverage => true },
+ :functest => { :desc => 'Runs Functional Tests', :prefix => 'func_documents', :required_file => 'functest_cred.rb', :coverage => true },
+ #:functest => { :desc => 'Runs Functional Tests', :prefix => 'func_', :required_file => 'functest_cred.rb', :coverage => true },
:alltest => { :desc => 'Runs All Tests at Once', :prefix => '', :required_file => 'functest_cred.rb', :coverage => true },
:setup_account => { :desc => 'Sets up a Test Account', :prefix => 'setup_', :required_file => 'it_cred.rb', :coverage => false },
}.each do |test_name,test_info|
@@ -64,3 +64,46 @@ end
task :default => :test
task :publish_rdoc => [:rdoc,:publish]
+
+require 'test/unit/ui/console/testrunner'
+
+class Test::Unit::UI::Console::TestRunner
+
+ alias :old_setup_mediator :setup_mediator
+ def setup_mediator
+ @tests_run = Hash.new
+ @tests_failed = Hash.new
+ old_setup_mediator
+ @mediator.add_listener(Test::Unit::TestCase::STARTED,&method(:test_was_started))
+ @mediator.add_listener(Test::Unit::TestResult::FAULT,&method(:test_has_failed))
+ end
+
+ alias :old_start :start
+ def start
+ retval = old_start
+ File.open("junit_output.xml","w") do |file|
+ file.puts "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"
+ file.puts "<testsuite errors=\"0\" skipped=\"0\" tests=\"#{@tests_run.size}\" time=\"#{Time.now.to_i}\""
+ file.puts "failures=\"#{@tests_failed.size}\" name=\"com.gliffy.ruby.unitTests\">"
+ @tests_run.each_key do |key|
+ file.puts "<testcase time=\"0\" name=\"#{key}\" />" if !@tests_failed[key]
+ end
+ @tests_failed.each_key do |test|
+ file.puts "<testcase time=\"0\" name=\"#{test.test_name}\">"
+ file.puts "<failure type=\"com.gliffy.ruby.unitTestFailure\" message=\"#{test.message.gsub(/\n/,' ')} failed\" />"
+ file.puts "</testcase>"
+ end
+ file.puts "</testsuite>"
+ end
+ return retval
+ end
+
+ def test_was_started(name)
+ @tests_run[name] = true
+ end
+
+ def test_has_failed(name)
+ @tests_failed[name] = true
+ end
+end
+
View
43 test/testbase.rb
@@ -1,48 +1,5 @@
require 'rubygems'
require 'rexml/formatters/pretty'
-
-require 'test/unit/ui/console/testrunner'
-
-class Test::Unit::UI::Console::TestRunner
-
- alias :old_setup_mediator :setup_mediator
- def setup_mediator
- @tests_run = Hash.new
- @tests_failed = Hash.new
- old_setup_mediator
- @mediator.add_listener(Test::Unit::TestCase::STARTED,&method(:test_was_started))
- @mediator.add_listener(Test::Unit::TestResult::FAULT,&method(:test_has_failed))
- end
-
- alias :old_start :start
- def start
- retval = old_start
- File.open("junit_output.xml","w") do |file|
- file.puts "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"
- file.puts "<testsuite errors=\"0\" skipped=\"0\" tests=\"#{@tests_run.size}\" time=\"#{Time.now.to_i}\""
- file.puts "failures=\"#{@tests_failed.size}\" name=\"com.gliffy.ruby.unitTests\">"
- @tests_run.each_key do |key|
- file.puts "<testcase time=\"0\" name=\"#{key}\" />" if !@tests_failed[key]
- end
- @tests_failed.each_key do |test|
- file.puts "<testcase time=\"0\" name=\"#{test.test_name}\">"
- file.puts "<failure type=\"com.gliffy.ruby.unitTestFailure\" message=\"#{test.message.gsub(/\n/,' ')} failed\" />"
- file.puts "</testcase>"
- end
- file.puts "</testsuite>"
- end
- return retval
- end
-
- def test_was_started(name)
- @tests_run[name] = true
- end
-
- def test_has_failed(name)
- @tests_failed[name] = true
- end
-end
-
class REXML::Formatters::Pretty
# fix cockup in RCov
alias old_wrap wrap
Please sign in to comment.
Something went wrong with that request. Please try again.