百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
C

ci_reporter

> 编程语言
开源

CI::Reporter 是一个添加到流行的测试框架中的插件,可让您生成 XML 报告

342 stars0 点赞3 次浏览
访问官网GitHub

工具介绍

CI::Reporter 是一个添加到流行的测试框架中的插件,可让您生成 XML 报告

CI::Reporter is an add-on to Ruby testing frameworks like Test::Unit or RSpec that allows you to generate XML reports of your test 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.

Usage

CI::Reporter works with projects that use standard Rake tasks for running tests. In this fashion, it hooks into testing frameworks using environment variables recognized by these custom tasks to inject the CI::Reporter code into the test run.

Each supported testing framework is provided by a separate gem:

  • Cucumber
  • Minitest
  • RSpec
  • Spinach
  • Test::Unit

Upgrading from CI::Reporter 1.x

CI::Reporter 1.x supported all the different test frameworks in a single gem. This was convenient, but caused issues as test frameworks released new, sometimes incompatibile, versions. CI::Reporter 2.x has been split into multiple gems, allowing each gem to specify the test framework versions it supports.

To upgrade to 2.x, remove ci_reporter from your Gemfile and replace it with one or more of the framework-specific gems above.

Jenkins setup

  1. Add the "Publish JUnit test result report" post-build step 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 test/reports, features/reports or spec/reports 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.

Conditional reporting

You may not wish to always produce report files. There are two primary ways to configure this:

With environment variables

Use an environment variable in your Rakefile to control if CI:Reporter will be invoked:

ruby
if ENV['GENERATE_REPORTS'] == 'true'
  require 'ci/reporter/rake/rspec'
  task :spec => 'ci:setup:rspec'
end

You can either inject this variable in your CI or simply call rake with the environment variable set:

GENERATE_REPORTS=true rake spec

With CI-specific Rake tasks

Instead of modifying your existing Rake tasks, create new ones:

ruby
namespace :ci do
  task :all => ['ci:setup:rspec', 'spec']
end

Then use this Rake target in CI:

rake ci:all

Environment Variables

  • CI_REPORTS: if set, points to a directory where report files will be written.
  • CI_CAPTURE: if set to value "off", stdout/stderr capture will be disabled.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Ruby

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言