Minitest reporter plugin for CircleCI
Ruby
Pull request Compare This branch is 46 commits ahead, 1 commit behind bhenderson:master.
Latest commit 5319f8d Jan 17, 2017 @zzak zzak committed on GitHub Merge pull request #12 from circleci/document-test-runner-setup
Document customer setup for reporter on CCI

README.rdoc

minitest-ci

Circle CI

DESCRIPTION:

Minitest reporter plugin for CircleCI

This gem was made possible by YP.com

Records test results and generates XML files (for junit hudson plugin for example) at the end of the test run.

USAGE:

In order to use this gem, add it to your Gemfile:

gem "minitest-ci"

To make integration with CircleCI easier, make sure you have a “:test” task defined. You can do simply by adding the following to your Rakefile:

require 'rake/testtask'

Rake::TestTask.new do |t|
  t.pattern = "test/test_*.rb"
end

task :default => :test

You should be on your way to continuous testing with Minitest and CircleCI!

For more complicated setups, see below.

Custom setup

To configure the test output folder, use the “–ci-dir=” option, setting it in TESTOPTS. On CircleCI, you might want to use something like this in your circle.yml:

test:
  override:
    - bundle exec rake test TESTOPTS="--ci-dir=$CIRCLE_TEST_REPORTS/reports":
        parallel: true
        files:
          - test/**/*.rb

Alternatively, you can add the following code to your test runner setup:

# test/helper.rb
require 'minitest'
require 'minitest/autorun'
require 'minitest/ci'

if ENV["CIRCLECI"]
  Minitest::Ci.report_dir = "#{ENV["CIRCLE_TEST_REPORTS"]}/reports"
end

class MiniTest::Test
  # include other helpers, etc
end

*NOTE*: The report directory is cleaned between test runs. To disable:

# test/helper.rb
Minitest::Ci.clean = false

# Rakefile (optional, but recommended)
task :ci_cleanup do
  require 'minitest/ci'
  Minitest::Ci.new.start
end
task :test => %w[ci_cleanup test:one test:two]

REQUIREMENTS:

  • Minitest > version 5