You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by mf...@redhat.com on 2012/08/29 12:17:12 UTC

[PATCH core] Tests: Added nicer output for tests and CI reporter

From: Michal Fojtik <mf...@redhat.com>

* The 'turn' gem will format the test output more nicely
  and the output is more readable.

* The 'minitest_reporters' gem will add JUnit XML output
  that is parseable by Jenkins  JUnit output is enabled
  when BUILD_NUMBER environment variable is set.

Signed-off-by: Michal fojtik <mf...@redhat.com>
---
 server/Gemfile              |    2 ++
 server/tests/test_helper.rb |   16 ++++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/server/Gemfile b/server/Gemfile
index 395e39d..6fcb914 100644
--- a/server/Gemfile
+++ b/server/Gemfile
@@ -10,6 +10,8 @@ group :development do
   gem "rack-test"
   gem "minitest"
   gem "simplecov"
+  gem 'turn'
+  gem 'minitest-reporters'
   gem "webmock"
   gem "vcr"
   gem "aws"
diff --git a/server/tests/test_helper.rb b/server/tests/test_helper.rb
index 57b7fb3..bed923d 100644
--- a/server/tests/test_helper.rb
+++ b/server/tests/test_helper.rb
@@ -20,6 +20,22 @@ if ENV['COVERAGE']
   end
 end
 
+# Make the test output more nice and readable
+#
+begin
+  require 'turn'
+  Turn.config do |c|
+    c.format  = :pretty
+    c.trace   = true
+    c.natural = true
+  end
+rescue; end
+
+begin
+  require "minitest/reporters"
+  MiniTest::Reporters.use!(MiniTest::Reporters::JUnitReporter.new) if !ENV['BUILD_NUMBER'].nil?
+rescue;end
+
 def record_retries(name='', opts = {})
   opts[:before] = Proc.new { |r, &block|
     VCR.use_cassette("#{__name__}-#{name.empty? ? '' : "#{name}-"}#{r}", &block)
-- 
1.7.10.2