Giter VIP home page Giter VIP logo

rspec_reports_formatter's Introduction

PLEASE NOTE - This project is not being actively maintained at the moment - I am taking a break - not sure when I will return.I'm unlikely to do do any more work on this project but will leave it here for posterity.

Publish pretty rspec reports

This is a ruby Rspec custom formatter which generates pretty html reports showing the results of rspec tests. This gem was build to use Rspec 3.x.x If you want to use it with older versions of Rspec then you should use the rspec_reports_formatter 0.2.x (2.8.0 branch)

  • For Rspec 2.x.x please use rspec_reports_formatter version starting with 0.2.x
  • For Rspec 3.x.x please use the rspec_reports_formatter version starting with 0.3.x

Install

  gem install rspec_html_formatter -v 0.3.1

ideally just add it to your bundler Gemfile as follows:

 gem 'rspec_html_formatter','~> 0.3.1'

Use

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

This should work:

 rspec -f RspecHtmlFormatter spec

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

 rspec --require rspec_html_formatter.rb --format RspecHtmlFormatter spec

![example overview report] (https://raw.githubusercontent.com/kingsleyh/rspec_reports_formatter/master/.README/rspec_reports_overview.png)

![example report] (https://raw.githubusercontent.com/kingsleyh/rspec_reports_formatter/master/.README/rspec_reports_report.png)

If you want to provide some generated documentation for the tests you can put comments in the rspec tests like this:

  #-> Given I have ordered a vegetarian pizza
  #-> When I eat the pizza
  #-> Then my tummy is full

The #-> notation is picked up and passed through a Gherkin syntax highlighter. So it was designed to use with Given,When,Then. But in theory you can put other text there too.

rspec_reports_formatter's People

Contributors

apshenkin avatar kingsleyh avatar kowal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

rspec_reports_formatter's Issues

this gem can't support windows xp/win7 platform when test case fails

in method "process_source":30
data = @backtrace_message.split(':')
e.g
it will contains "d:\work\git\test\spec\test_spec.rb:8:in block (2 levels) in <top (required)>" in @backtrace_message
so it will returns an array ['d','\work\git\test\spec\test_spec.rb','8','in block (2 levels) in <top (required)>'] when the method "split" is executed.
and Array.first is "d"
Array[1] is not "8" ,it is '\work\git\test\spec\test_spec.rb
so it can not be use 'to_i' method

i have a qestion in rspec_html_formatter:51

when i use
formatter.format(lexer.lex(source)) in line 64
and then excute rspec
it always display this error as following:
in process_source ,undefined method + for NilClass

now i use latest code, it runs fine.

an issue when i set the expected value with chinese in rspec

copy the code in here.

encoding: utf-8

require 'rspec'

describe 'My behaviour' do
it "successful" do
1.should eql 1
end
it 'successful' do
abc = '大家一起'
abc.should include '我们'
end

end
An error displays when i execute it with rspec_html_formatter .
124:in match:invalid byte sequence in GBK
i try to change the code from 'spec = code_block.select { |l| l.match(/#->/) }.join('')' to 'spec = code_block.select { |l| l.encode('utf-8').match(/#->/) }.join('')'
but it was still wrong.
could you help me to resolve this problem?
Thank you very much.

How to add additional info to rspec_reports_formatter report ?

Hi,

I planning to use" rspec_reports_formatter" gem to generate detailed report. As provided in below link
https://github.com/kingsleyh/rspec_reports_formatter

I tried using "#->" to add additional information to report. But not able generate html report with additional information.

Here is the attached code for the same.
shared_steps
spec_file

generated report using rspec_formatter .

htmlformatter_report

I am not sure where i am going wrong. could you please help me in

  1. Generating detailed report with additional info ?
  2. I am seeing text "lodaing" in the generated report in place of charts /graphs in the report.Do i need to do any additional work, to display charts /graphs in the report?

Thanks,
Chandana

class Example initialized will fail when something occurs error

class Example initialized will fail when something occurs error, and the remaining test cases will be blocked.
eg:it will often occur RuntimeError when i have a website automation test

and i fixed this issue with the following code.

def example_failed(example)
@group_example_failure_count += 1
begin
@group_examples << Example.new(example)
rescue RuntimeError
puts "example initialize failed"
end
end

This gem can not support nested example group?

when i organize my test cases in this style. the html report doesn't display right.
describe "first example group" do
it "should be success" do
1.should eql 1
end
describe "nested example group" do
it "should be success again" do
2.should eql 2
end
end
it "should be failure" do
1.should eql 2
end
it "should be pending" do
pending
end
end

multi-run reports

Awesome project!

I have a quick question.

In my case each rspec invocation has to perform some test-specific setup, for other reasons I can't run them all at once.

How could I handle building cumulative reports from multiple rspec runs? No specs are repeated during those runs. It would be nice to display it on single 'overview' page. Is that currently possible? I could possibly copy generated files after each rspec run into some target directory but how to "merge" overview.html at the end?

thx & have a nice weekend!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.