All Projects → sj26 → Rspec_junit_formatter

sj26 / Rspec_junit_formatter

Licence: mit
RSpec results that your CI can read

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Rspec junit formatter

Skyhook
Parses webhooks and forwards them in the proper format to Discord.
Stars: ✭ 263 (+3.14%)
Mutual labels:  jenkins, circleci
Nevergreen
🐤 A build monitor with attitude
Stars: ✭ 170 (-33.33%)
Mutual labels:  jenkins, circleci
Threatmapper
Identify vulnerabilities in running containers, images, hosts and repositories
Stars: ✭ 361 (+41.57%)
Mutual labels:  jenkins, circleci
Ci Matters
Integration (comparison) of different continuous integration services on Android project
Stars: ✭ 119 (-53.33%)
Mutual labels:  jenkins, circleci
j8spec
Library that allows tests written in Java to follow the BDD style introduced by RSpec and Jasmine.
Stars: ✭ 45 (-82.35%)
Mutual labels:  rspec, junit
Dockerspec
A small Ruby Gem to run RSpec and Serverspec, Infrataster and Capybara tests against Dockerfiles or Docker images easily.
Stars: ✭ 181 (-29.02%)
Mutual labels:  circleci, rspec
Ci Detector
Detect continuous integration environment and get information of current build
Stars: ✭ 138 (-45.88%)
Mutual labels:  jenkins, circleci
Spectrum
A BDD-style test runner for Java 8. Inspired by Jasmine, RSpec, and Cucumber.
Stars: ✭ 142 (-44.31%)
Mutual labels:  rspec, junit
playwright-ci
☁️ Set up Playwright in CI
Stars: ✭ 27 (-89.41%)
Mutual labels:  jenkins, circleci
Build Harness
🤖Collection of Makefiles to facilitate building Golang projects, Dockerfiles, Helm charts, and more
Stars: ✭ 236 (-7.45%)
Mutual labels:  jenkins, circleci
Env Ci
Get environment variables exposed by CI services
Stars: ✭ 180 (-29.41%)
Mutual labels:  jenkins, circleci
wdio-junit-reporter
A WebdriverIO v4 plugin. Report results in junit xml format.
Stars: ✭ 13 (-94.9%)
Mutual labels:  jenkins, junit
ginkgo4j
A Java BDD Testing Framework (based on RSpec and Ginkgo)
Stars: ✭ 25 (-90.2%)
Mutual labels:  rspec, junit
CIAnalyzer
A tool collecting multi CI services build data and export it for creating self-hosting build dashboard.
Stars: ✭ 52 (-79.61%)
Mutual labels:  jenkins, circleci
gradle-console-reporter
Gradle plugin to report various kinds of summaries to console.
Stars: ✭ 49 (-80.78%)
Mutual labels:  junit
jsonapi-swagger
Create a JSONAPI Swagger.
Stars: ✭ 49 (-80.78%)
Mutual labels:  rspec
pipeline-as-code-with-jenkins
Pipeline as Code with Jenkins
Stars: ✭ 56 (-78.04%)
Mutual labels:  jenkins
webdrivermanager-examples
JUnit tests with Selenium WebDriver and WebDriverManager
Stars: ✭ 94 (-63.14%)
Mutual labels:  junit
netdevops-cicd-snmpv3
NetDevOps CICD SNMPv3 Demo
Stars: ✭ 23 (-90.98%)
Mutual labels:  jenkins
build-status
Emacs minor mode that monitors and shows a buffer's build status in the mode line.
Stars: ✭ 26 (-89.8%)
Mutual labels:  circleci

RSpec JUnit Formatter

Build results Gem version

RSpec 2 & 3 results that your CI can read. Jenkins, Buildkite, CircleCI, Gitlab, and probably more, too.

Usage

Install the gem:

gem install rspec_junit_formatter

Use it:

rspec --format RspecJunitFormatter --out rspec.xml

You'll get an XML file rspec.xml with your results in it.

You can use it in combination with other formatters, too:

rspec --format progress --format RspecJunitFormatter --out rspec.xml

Using in your project with Bundler

Add it to your Gemfile if you're using Bundler. Put it in the same groups as rspec.

group :test do
  gem "rspec"
  gem "rspec_junit_formatter"
end

Put the same arguments as the commands above in your .rspec:

--format RspecJunitFormatter
--out rspec.xml

Parallel tests

For use with parallel_tests, add $TEST_ENV_NUMBER in the output file option (in .rspec or .rspec_parallel) to avoid concurrent process write conflicts.

--format RspecJunitFormatter
--out tmp/rspec<%= ENV["TEST_ENV_NUMBER"] %>.xml

The formatter includes $TEST_ENV_NUMBER in the test suite name within the XML, too.

Capturing output

If you like, you can capture the standard output and error streams of each test into the :stdout and :stderr example metadata which will be added to the junit report, e.g.:

# spec_helper.rb

RSpec.configure do |config|
  # register around filter that captures stdout and stderr
  config.around(:each) do |example|
    $stdout = StringIO.new
    $stderr = StringIO.new

    example.run

    example.metadata[:stdout] = $stdout.string
    example.metadata[:stderr] = $stderr.string

    $stdout = STDOUT
    $stderr = STDERR
  end
end

Note that this example captures all output from every example all the time, potentially interfering with local debugging. You might like to restrict this to only on CI, or by using rspec filters.

Caveats

  • XML can only represent a limited subset of characters which excludes null bytes and most control characters. This gem will use character entities where possible and fall back to replacing invalid characters with Ruby-like escape codes otherwise. For example, the null byte becomes \0.

Development

Run the specs with bundle exec rake, which uses Appraisal to run the specs against all supported versions of rspec.

Releasing

Bump the gem version in the gemspec, and commit. Then bundle exec rake build to build a gem package, bundle exec rake install to install and test it locally, then bundle exec rake release to tag and push the commits and gem.

License

The MIT License, see LICENSE.

Thanks

Inspired by the work of Diego Souza on RSpec Formatters after frustration with CI Reporter.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].