Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 47 lines (29 sloc) 3.186 kB
bfdcd21 @nicksieger - Prepare for 1.0 release; last set of changes in current svn location
nicksieger authored
1 CI::Reporter is an add-on to Test::Unit and RSpec that allows you to generate
2 XML reports of your test and/or spec runs. The resulting files can be read by
3 a continuous integration system that understands Ant's JUnit report XML
4 format, thus allowing your CI system to track test/spec successes and
5 failures.
6
f02e44c @nicksieger Creating new ci_reporter svn structure
nicksieger authored
7 == Dependencies
8
9 CI::Reporter has one required dependency on Builder, but since many will have a viable version of Builder via Rails' ActiveSupport gem, Builder is not a direct dependency of the project at the moment. Instead, ensure that you have either the +builder+ or +activesupport+ gem installed before continuing.
10
bfdcd21 @nicksieger - Prepare for 1.0 release; last set of changes in current svn location
nicksieger authored
11 == Installation
12
13 CI::Reporter is available as a gem. To install the gem, use the usual gem command:
14
15 gem install ci_reporter
16
17 To use CI::Reporter as a Rails plugin, first install the gem, and then install the plugin as follows:
18
19 script/plugin install http://svn.caldersphere.net/svn/main/plugins/ci_reporter
20
21 == Usage
22
23 CI::Reporter works best with projects that use a +Rakefile+ along with the standard <code>Rake::TestTask</code> or <code>Spec::Rake::SpecTask</code> tasks for running tests or specs, respectively. In this fashion, it hooks into <code>Test::Unit</code> or +RSpec+ using environment variables recognized by these custom tasks to inject the CI::Reporter code into the test or spec runs. If you're using the Rails plugin, step 1 is unnecessary; skip to step 2.
24
25 1. To use CI::Reporter, simply add the following lines to your Rakefile:
26
27 require 'rubygems'
28 gem 'ci_reporter'
29 require 'ci/reporter/rake/rspec' # use this if you're using RSpec
30 require 'ci/reporter/rake/test_unit' # use this if you're using Test::Unit
31
32 2. Next, either modify your Rakefile to make the <code>ci:setup:rspec</code> or <code>ci:setup:testunit</code> task a dependency of your test tasks, or include them on the Rake command-line before the name of the task that runs the tests or specs.
33
34 rake ci:setup:testunit test
35
cbe1c35 @nicksieger updated documentation w/ mention of CI_REPORTS
nicksieger authored
36 Report files are written, by default, to the <code>test/reports</code> or <code>spec/reports</code> subdirectory of your project. If you wish to customize the location, simply set the environment variable CI_REPORTS (either in the environment, on the Rake command line, or in your Rakefile) to the location where they should go.
37
bfdcd21 @nicksieger - Prepare for 1.0 release; last set of changes in current svn location
nicksieger authored
38 == Advanced Usage
39
cbe1c35 @nicksieger updated documentation w/ mention of CI_REPORTS
nicksieger authored
40 If for some reason you can't use the above technique to inject CI::Reporter (e.g., you're not using Rake), you'll have to do one of these:
bfdcd21 @nicksieger - Prepare for 1.0 release; last set of changes in current svn location
nicksieger authored
41
42 1. If you're using <code>Test::Unit</code>, ensure the <code>ci/reporter/rake/test_unit_loader.rb</code> file is loaded or required at some point before the tests are run.
43 2. If you're using +RSpec+, you'll need to pass the following arguments to the +spec+ command:
44 --require GEM_PATH/lib/ci/reporter/rake/rspec_loader
45 --format CI::Reporter::RSpec
46
47 There's a bit of a chicken and egg problem because rubygems needs to be loaded before you can require any CI::Reporter files. If you cringe hard-coding a full path to a specific version of the gem, you can also copy the +rspec_loader+ file into your project and require it directly -- the contents are version-agnostic and are not likely to change in future releases.
Something went wrong with that request. Please try again.