<commit_before>CI::Reporter is an add-on to Test::Unit, RSpec and Cucumber that allows you to generate XML reports of your test, spec and/or feature runs. The resulting files can be read by a continuous integration system that understands Ant's JUnit report XML format, thus allowing your CI system to track test/spec successes and failures.

== Installation

CI::Reporter is available as a gem. To install the gem, use the usual gem command:

    gem install ci_reporter

== Usage

CI::Reporter works best with projects that use a +Rakefile+ along with the standard <code>Rake::TestTask</code> or <code>Spec::Rake::SpecTask/RSpec::Core::RakeTask</code> tasks for running tests or examples, 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.

1. To use CI::Reporter, simply add the following lines to your Rakefile:

    require 'rubygems'
    require 'ci/reporter/rake/rspec'     # use this if you're using RSpec
    require 'ci/reporter/rake/cucumber'  # use this if you're using Cucumber
    require 'ci/reporter/rake/test_unit' # use this if you're using Test::Unit
    require 'ci/reporter/rake/minitest' # use this if you're using MiniTest::Unit

2. Next, either modify your Rakefile to make the <code>ci:setup:rspec</code>, <code>ci:setup:cucumber</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.

    rake ci:setup:testunit test

Report files are written, by default, to the <code>test/reports</code>, <code>features/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.

== Advanced Usage

If you don't have control over the Rakefile or don't want to modify it, CI::Reporter has a substitute rake file that you can specify on the command-line.  It assumes that the main project rake file is called +Rakefile+ and lives in the current directory.  Run like so:

    rake -f GEM_PATH/stub.rake ci:setup:testunit test
    rake -f GEM_PATH/stub.rake ci:setup:minitest test
    rake -f GEM_PATH/stub.rake ci:setup:rspec spec
    rake -f GEM_PATH/stub.rake ci:setup:cucumber features

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:
<commit_msg>Add clearer documentation about how to integrate with Jenkins and how to run the rake tasks<commit_after>CI::Reporter is an add-on to Test::Unit, RSpec and Cucumber that allows you to generate XML reports of your test, spec and/or feature runs. The resulting files can be read by a continuous integration system that understands Ant's JUnit report XML format, thus allowing your CI system to track test/spec successes and failures.

== Installation

CI::Reporter is available as a gem. To install the gem, use the usual gem command:

    gem install ci_reporter

== Usage

CI::Reporter works best with projects that use a +Rakefile+ along with the standard <code>Rake::TestTask</code> or <code>Spec::Rake::SpecTask/RSpec::Core::RakeTask</code> tasks for running tests or examples, 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.

1. To use CI::Reporter, simply add the following lines to your Rakefile:

    require 'rubygems'
    require 'ci/reporter/rake/rspec'     # use this if you're using RSpec
    require 'ci/reporter/rake/cucumber'  # use this if you're using Cucumber
    require 'ci/reporter/rake/test_unit' # use this if you're using Test::Unit
    require 'ci/reporter/rake/minitest' # use this if you're using MiniTest::Unit

2. Next, either modify your Rakefile to make the <code>ci:setup:rspec</code>, <code>ci:setup:cucumber</code> or <code>ci:setup:testunit</code> task a dependency of your test tasks, or run one of these rake tasks:

    rake ci:setup:testunit test
    rake ci:setup:minitest test
    rake ci:setup:rspec spec
    rake ci:setup:cucumber features

== Jenkins setup

1. Tick the box labelled "Publish JUnit test result report" in the job configuration

2. Enter "test/reports/*.xml,spec/reports/*.xml" in the "Test report XMLs" field (adjust this to suit which tests you are running)

Report files are written, by default, to the <code>test/reports</code>, <code>features/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.


== Advanced Usage

If you don't have control over the Rakefile or don't want to modify it, CI::Reporter has a substitute rake file that you can specify on the command-line.  It assumes that the main project rake file is called +Rakefile+ and lives in the current directory.  Run like so:

    rake -f GEM_PATH/stub.rake ci:setup:testunit test
    rake -f GEM_PATH/stub.rake ci:setup:minitest test
    rake -f GEM_PATH/stub.rake ci:setup:rspec spec
    rake -f GEM_PATH/stub.rake ci:setup:cucumber features

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:

{'fraction_non_alphanumeric': 0.07733657014045431, 'fraction_numerical': 0.0017340038148083927, 'mean_word_length': 4.400749063670412, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6361187', 'n_tokens_mistral': 1717, 'n_tokens_neox': 1639, 'n_words': 782}