No commit activity in last 3 years
No release in over 3 years
Rspec html formatter to generate pretty results with images
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.0
~> 2.1.1
~> 3.12
~> 3.0.0

Runtime

>= 1.6.1
>= 3.0.3
 Project Readme

Publish pretty rspec reports with images

PLEASE NOTE - This is a fork from rspec_reports_formatter

This is a RSpec formatter which generates pretty html reports showing the results of rspec tests, where you can also easily attach images and screenshots.

Why another formatter?

On CI servers, xUnit xml test reports are quite "standard", but the attachments cannot be linked to a concrete test. I mean, just look at this.

kingsleyh created a nicer interface using an RSpec formatter with rspec_reports_formatter, but it had some issues with nested blocks and it was still not possible to attach images.

With rspec_yah_formatter you can attach images, which is very useful for capybara, selenium and so on.

Features

This report is inspired in rspec_reports_formatter, with some differences:

  • All examples are shown in the same page. This makes it simpler, and also avoids this
  • As mentioned, you can add images
  • To avoid that the page is filled with stacktraces and images, errors are by default hidden, and you can show them by clicking on them.
  • This report only makes sense in html, so you must specify a file in --outwhen running rspec

Here is also the Changelog and a TODO list

Install

This gem was build to use Rspec 3.x.x

  gem install rspec_yah_formatter -v 0.0.7

ideally just add it to your bundler Gemfile as follows:

 gem 'rspec_yah_formatter','~> 0.0.7'

Use

When running your rspec tests with rspec 3.0.0 just use the custom formatter:

This should work:

 rspec spec/my/spec -f RspecYahFormatter --out path/to/report.html

If not you can explicitly add in a require as follows:

 rspec spec/my/spec --require rspec_yah_formatter.rb --format RspecYahFormatter --out path/to/report.html

To add images:

RSpec.configure do |config|
  config.after(:each) do |example|
    if example.exception
        # Save screenshot to 'path/to/foo.png'
        example.metadata[:screenshot] = 'path/to/foo.png'
    end
  end
end

Show me something

Generated with spec/test2_spec.rb

![example report] (https://raw.githubusercontent.com/dgmora/rspec_yah_formatter/master/.README/example.png)