Code Monkey home page Code Monkey logo

allure-rspec's Introduction

[DEPRECATED]

Allure RSpec Adaptor

Gem Version

Adaptor to use the Allure framework along with the RSpec. See an example project to take a quick tour.

What's new

See the releases tab.

Setup

Add the dependency to your Gemfile. Choose the version carefully:

  • 0.5.x - for RSpec2.
  • <= 0.6.7 - for RSpec < 3.2.
  • = 0.6.9 - for RSpec >= 3.2.

 gem 'allure-rspec'

And then include it in your spec_helper.rb:

    require 'allure-rspec'

    RSpec.configure do |c|
      c.include AllureRSpec::Adaptor
    end

Advanced options

You can specify the directory where the Allure test results will appear. By default it would be 'gen/allure-results' within your current directory.

    AllureRSpec.configure do |c|
      c.output_dir = "/whatever/you/like" # default: gen/allure-results
      c.clean_dir = false # clean the output directory first? (default: true)
      c.logging_level = Logger::DEBUG # logging level (default: DEBUG)
    end

Usage examples

describe MySpec, :feature => "Some feature", :severity => :normal do

  before(:step) do |s|
    puts "Before step #{s.current_step}"
  end

  it "should be critical", :story => "First story", :severity => :critical, :testId => 99 do
    "string".should == "string"
  end

  it "should be steps enabled", :story => ["First story", "Second story"], :testId => 31 do |e|

    e.step "step1" do |s|
      s.attach_file "screenshot1", take_screenshot_as_file
    end

    e.step "step2" do
      5.should be > 0
    end

    e.step "step3" do
      0.should == 0
    end

    e.attach_file "screenshot2", take_screenshot_as_file
  end
end

allure-rspec's People

Contributors

baev avatar maccracken avatar sharmarahul avatar shockwavenn avatar smecsia 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

Watchers

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

allure-rspec's Issues

Duplicate failed tests are reported

I have just upgraded to the latest allure report generator. My allure report version is now 1.4.20. After the upgrade, I see that twice the number of failed tests are being reported.

The stack trace in the report not escaping special characters like <>

As an example this is what I see in the stack trace:

undefined method `find' for #<Selenium::WebDriver::Element:0x007fd5c5a302f8>

./spec/helpers/common_helper.rb:540:in delete_widget' ./spec/helpers/common_helper.rb:527:inblock in clean_up_designer'
./spec/helpers/common_helper.rb:527:in clean_up_designer' ./spec/regression2/map_spec.rb:16:inblock (2 levels) in <top (required)>'

When the real error is
NoMethodError: undefined method `find' for #Selenium::WebDriver::Element:0x007fd96b5227d0

/Users/mpahuja/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.8/lib/rspec/core/metadata.rb:187:in for_example&apos; /Users/mpahuja/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.8/lib/rspec/core/example.rb:81:ininitialize' /Users/mpahuja/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:66:in new&apos; /Users/mpahuja/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:66:init' /Users/mpahuja/dev/wsb-ruby-automation/spec/regression2/map_spec.rb:31:in block in &lt;top (required)&gt;&apos; /Users/mpahuja/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:246:inmodule_eval' /Users/mpahuja/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:246:in subclass&apos; /Users/mpahuja/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:232:indescribe' /Users/mpahuja/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.8/lib/rspec/core/dsl.rb:18:in describe&apos; /Users/mpahuja/dev/wsb-ruby-automation/spec/regression2/map_spec.rb:3:in<top (required)>' /Users/mpahuja/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in load&apos; /Users/mpahuja/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:inblock in load_spec_files' /Users/mpahuja/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in each&apos; /Users/mpahuja/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:inload_spec_files' /Users/mpahuja/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.8/lib/rspec/core/command_line.rb:22:in run&apos; /Users/mpahuja/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.8/lib/rspec/core/runner.rb:80:inrun' /Users/mpahuja/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.8/lib/rspec/core/runner.rb:17:in `block in autorun'

Error when trying to re-run the tests

This seems to be happening intermittently but in my Rake File I am re-running the failed tests and i see this error message which results in marking a false failure of my jenkins build

C:/Ruby193/lib/ruby/gems/1.9.1/gems/allure-ruby-adaptor-api-0.6.2/lib/allure-ruby-adaptor-api/builder.rb:118:in `build!': undefined method `each' for nil:NilClass (NoMethodError)
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/allure-rspec-0.5.3/lib/allure-rspec/formatter.rb:63:in `stop'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.8/lib/rspec/core/reporter.rb:127:in `block in notify'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.8/lib/rspec/core/reporter.rb:126:in `each'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.8/lib/rspec/core/reporter.rb:126:in `notify'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.8/lib/rspec/core/reporter.rb:122:in `stop'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.8/lib/rspec/core/reporter.rb:106:in `finish'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.8/lib/rspec/core/reporter.rb:60:in `report'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.8/lib/rspec/core/command_line.rb:25:in `run'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.8/lib/rspec/core/runner.rb:80:in `run'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.8/lib/rspec/core/runner.rb:17:in `block in autorun'

Please note I am use allure-rspec (0.5.3) with Rspec 2.14.1
Snippet from Gemfile.lock

    allure-rspec (0.5.3)
      allure-ruby-adaptor-api (= 0.6.2)
      rspec (~> 2.14.0)
    allure-ruby-adaptor-api (0.6.2)

Can someone please guide me if I am missing something here?

How can I get Test Case Body (with Log messages) on HTML Test Overview

Hi,

Could you help me out in this question? I'm pretty new here. So I'm not sure, may this would be a feature request or I'm just missed a major info somewhere... I'd like to use Test Case Overview > Test Body in Allure RSpec HTML report to show the failed test step along with the related test case.

Something like that was described here: allure-framework/allure-python#209.

So I'd like to see the failed step within the test case. Unfortunately I was not able to find a related documentation or a Q&A for RSpec Allure Reporter Test Body.

I found some related questions in case of other languages like at: https://github.com/allure-framework/allure-mocha/issues/38 and allure-framework/allure-java#113

Error when using rake task

I tried putting the config.include AllureRSpec::Adaptor in both spec_helper.rb and rails_helper.rb. When I try to run rspec spec\models, it runs successfully, outputting xml data. When I try to use one of the rake tasks, i.e. rake spec:models, it fails with the following error:

NameError: uninitialized constant RSpec::Support
/Users/timothy/.rvm/gems/ruby-2.1.0@skillet/gems/rspec-core-3.3.2/lib/rspec/core/formatters/base_formatter.rb:1:in `<top (required)>'
/Users/timothy/.rvm/gems/ruby-2.1.0@skillet/gems/allure-rspec-0.7.4/lib/allure-rspec/formatter.rb:1:in `<top (required)>'
/Users/timothy/.rvm/gems/ruby-2.1.0@skillet/gems/allure-rspec-0.7.4/lib/allure-rspec.rb:3:in `<top (required)>'

Looking into this, it seems to be trying to load a specific formatter before RSpec::Core has been loaded.

I'm running RSpec 3.3.0 and Rails 4.1.13. What am I doing wrong? Let me know if you need any more information.

Deprecation warning when using the gem

Here is the warning that is being currently shown:

The :example_group key in an example group's metadata hash is deprecated. Use the example group's hash directly for the computed keys and :parent_example_group to access the parent example group metadata instead. Called from C:/Ruby193/lib/ruby/gems/1.9.1/gems/allure-rspec-0.6.8/lib/allure-rspec/formatter.rb:95:in `yield'.

can't excute one-liner in model spec

Hello, I tried to use Allure at model spec, but it doesn't work.
I found this problem is caused by one-liner spec, but I didn't fix it.

I make a user model, which has name column.
Then write a spec 'spec/models/user_spec.rb'.

require "rails_helper"

RSpec.describe User, :type => :model do
  before do
    @user = User.create(name: "user")
  end
  subject { @user }
  it { is_expected.to be_valid }
end

run this spec, this error message is shown.

Starting test User.User should be valid with labels {}

NoMethodError: undefined method `[]' for nil:NilClass
/home/user/.rvm/gems/ruby-2.2.0-preview1/gems/allure-ruby-adaptor-api-0.6.6/lib/allure-ruby-adaptor-api/builder.rb:43:in `stop_test'
/home/user/.rvm/gems/ruby-2.2.0-preview1/gems/allure-rspec-0.6.9/lib/allure-rspec/formatter.rb:63:in `stop_test'
/home/user/.rvm/gems/ruby-2.2.0-preview1/gems/allure-rspec-0.6.9/lib/allure-rspec/formatter.rb:27:in `example_passed'
/home/user/.rvm/gems/ruby-2.2.0-preview1/gems/ruby-debug-ide-0.4.24/lib/ruby-debug-ide.rb:86:in `debug_load'
/home/user/.rvm/gems/ruby-2.2.0-preview1/gems/ruby-debug-ide-0.4.24/lib/ruby-debug-ide.rb:86:in `debug_program'
-e:1:in `load'
-e:1:in `<main>'

I debug the spec and found at function "stop_test", 'self.suites[suite][:tests][test]' is nil.

  def stop_test(suite, test, result = {})
    self.suites[suite][:tests][test][:steps].each do |step_title, step|
      if step[:stop].nil? || step[:stop] == 0
        stop_step(suite, test, step_title, result[:status])
      end
    end
    .
    .

When this test case, values are below:

suite => "User"
test => "User should be valid"
self.suites => {
    "User"=> {
        :title=>"User", 
        :start=>1427879918114,
        :tests=> {
            "User "=> {
                :title=>"User should be valid",
                :start=>1427879918116,
                :failure=>nil,
                :steps=>{}, 
                :attachments=>[], 
                :labels=>{:thread=>18398360, :host=>"notePC-003"}
            }
        }, 
        :labels=>{:thread=>18398360, :host=>"notePC-003"}
    }
}

I think 'self.suites[suite][:tests][test]' should be equal "User should be valid", but now it is 'User'.
the place set 'test' is a function 'example_started', so I tried to fix it, however, I don't know what to do.

def example_started(notification)
  suite = description(notification.example.example_group).to_s
  test = description(notification.example).to_s
  AllureRubyAdaptorApi::Builder.start_test(suite, test, labels(notification))
end

Doesn't work with RSpec 3.0?

Output:

Fetching gem metadata from https://rubygems.org/.......
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Bundler could not find compatible versions for gem "rspec":
In Gemfile:
allure-rspec (>= 0) ruby depends on
rspec-steps (~> 0.1.1) ruby depends on
rspec (< 2.14.0, >= 2.6) ruby

rspec (3.0.0)

Incorrect Stack trace being shown in the report

Stacktrace in the report:

unknown error: Element is not clickable at point (868, 565). Other element would receive the click: <div class="wsb-nav-arrange-wrap clearfix">...</div> (Session info: chrome=36.0.1985.125) (Driver info: chromedriver=2.10.267517,platform=Mac OS X 10.8.5 x86_64)

/Users/mpahuja/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.8/lib/rspec/core/metadata.rb:187:in `for_example' /Users/mpahuja/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.8/lib/rspec/core/example.rb:81:in `initialize' 
/Users/mpahuja/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:66:in `new' /Users/mpahuja/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:66:in `it' /Users/mpahuja/dev/wsb-ruby-automation/spec/regression2/navigation_spec.rb:110:in `block in <top (required)>' 
/Users/mpahuja/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:246:in `module_eval' /Users/mpahuja/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:246:in `subclass' 
/Users/mpahuja/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:232:in `describe' /Users/mpahuja/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.8/lib/rspec/core/dsl.rb:18:in `describe' /Users/mpahuja/dev/wsb-ruby-automation/spec/regression2/navigation_spec.rb:3:in `<top (required)>' 
/Users/mpahuja/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in `load' /Users/mpahuja/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in `block in load_spec_files' 
/Users/mpahuja/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in `each' /Users/mpahuja/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in `load_spec_files' 
/Users/mpahuja/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.8/lib/rspec/core/command_line.rb:22:in `run' /Users/mpahuja/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.8/lib/rspec/core/runner.rb:80:in `run' /Users/mpahuja/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.8/lib/rspec/core/runner.rb:17:in `block in autorun'

Actual stacktrace that is useful as well:

    Selenium::WebDriver::Error::UnknownError:
       unknown error: Element is not clickable at point (868, 565). Other element would receive the click: <div class="wsb-nav-arrange-wrap clearfix">...</div>
         (Session info: chrome=36.0.1985.125)
         (Driver info: chromedriver=2.10.267517,platform=Mac OS X 10.8.5 x86_64)
     # ./spec/helpers/designer/navigation_helper.rb:107:in `click_link_on_nav_widget'
     # ./spec/regression2/navigation_spec.rb:134:in `block (2 levels) in <top (required)>'

In the second stacktrace you can see it tells me the actual method where it failed

"Clearing out unresolved specs" causes problems

Hi guys,
Let's look at screenshot of Jenkins Job console output

image

Here we can see Passed test suite (0 failures) and also some process started after tests finished
actually this is executing of some code from shared_for_all.rb file where I store a lot of shared_examples (and shared_context) code blocks
It shouldn't run at all here but as you can see it's running

Plus all this stuff ends with this lines:

image

Here we can see some failed runs (I don't know why it's been executed here)

And line "Build step 'Invoke Rake' marked build as failure" marks current build as failed even when no failures appeared

Please help me here
Also if I should move this issue to the allure-plugin repository just ask, I'll do

Thank you

uninitialized constant AllureRSpec::Formatter::Pathname (NameError)

E:\Program Files\Sublime Text 3\workspace>rspec hello_spec.rb
D:/Program Files/Ruby23-x64/lib/ruby/gems/2.3.0/gems/allure-rspec-0.8.0/lib/allure-rspec/formatter.rb:42:in `start': uninitialized constant AllureRSpec::Formatter::Pathname (NameError)
        from D:/Program Files/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rspec-core-3.7.1/lib/rspec/core/reporter.rb:206:in `block in notify'
        from D:/Program Files/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rspec-core-3.7.1/lib/rspec/core/reporter.rb:205:in `each'
        from D:/Program Files/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rspec-core-3.7.1/lib/rspec/core/reporter.rb:205:in `notify'
        from D:/Program Files/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rspec-core-3.7.1/lib/rspec/core/reporter.rb:90:in `start'
        from D:/Program Files/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rspec-core-3.7.1/lib/rspec/core/reporter.rb:77:in `report'
        from D:/Program Files/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rspec-core-3.7.1/lib/rspec/core/runner.rb:112:in `run_specs'
        from D:/Program Files/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rspec-core-3.7.1/lib/rspec/core/runner.rb:87:in `run'
        from D:/Program Files/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rspec-core-3.7.1/lib/rspec/core/runner.rb:71:in `run'
        from D:/Program Files/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rspec-core-3.7.1/lib/rspec/core/runner.rb:45:in `invoke'
        from D:/Program Files/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rspec-core-3.7.1/exe/rspec:4:in `<top (required)>'
        from D:/Program Files/Ruby23-x64/bin/rspec:22:in `load'
        from D:/Program Files/Ruby23-x64/bin/rspec:22:in `<main>'

rspec 3.7
allure-rspec 0.8.0

require 'rspec'
require 'allure-rspec'
AllureRSpec.configure do |c|
  c.output_dir = File.join(__dir__, '..', 'rspec_reports')
end
RSpec.configure do |config|
  config.include AllureRSpec::Adaptor
end

describe 'hello' do
  it 'allure-rspec' do
    expect(true).to be_truthy
  end
end

hello!I still have this problem

Enhancement Request: before(:step) after(:step)

To properly get the reporting right, I'm using the step keyword inside the it blocks. Part of our automated requirements is to update the test step status in our test case management tool (Zephyr). Would it be possible to add before(:step) and after(:step) hooks or is that outside the scope of this tool? Without it, I'll have to move back to using it blocks for each step.

after(:step) do |x|
    update_zephyr_step_result(x)
end

it 'SC-12345' do
    # Pre-Requisites
    scanners_page = @dashboard_page.to_scanners

    # Steps
    step @zephyr_steps[:steps][1][:step] do 
        @scanners_add_page = scanners_page.click_add_button() 
    end
end

Using alternative to testId tag

Hi, I am in process of implementing allure in a rspec framework and I faced a problem. I already have every test tagged by a crail_id tag and this value is being used down the pipe in multiple places, so changing the tag name is not that easy for me.

I had a feeling that I could just add the testId to metadata, but it is not being picked up by the allure reports.

Could you shed some light on this?

Example Group errors

As soon as I add:

RSpec.configure do |c|
c.include AllureRSpec::Adaptor
end

I get:

NoMethodError: undefined method `example_group' for #RSpec::Core::Notifications::ExampleNotification:0x0000010131b2b0

I cannot figure out what I'm doing wrong here. Any ideas?

uninitialized constant AllureRSpec::Formatter::Pathname (NameError)

Env:

wuhuizuo@debian-wuhuizuo:~/apps/j2test$ ruby -v
ruby 2.1.5p273 (2014-11-13) [x86_64-linux-gnu]
wuhuizuo@debian-wuhuizuo:~/apps/j2test$ gem list allure

*** LOCAL GEMS ***

allure-rspec (0.7.7)
allure-ruby-adaptor-api (0.6.10)
wuhuizuo@debian-wuhuizuo:~/apps/j2test$ gem list rspec

*** LOCAL GEMS ***

allure-rspec (0.7.7)
rspec (3.4.0)
rspec-core (3.4.3)
rspec-expectations (3.4.0)
rspec-mocks (3.4.1)
rspec-support (3.4.1)

Test script:

# filename spec/hello_spec.rb

require 'rspec'
require 'allure-rspec'
AllureRSpec.configure do |c|
  c.output_dir = File.join(__dir__, '..', 'rspec_reports')
end
RSpec.configure do |config|
  config.include AllureRSpec::Adaptor
end

describe 'hello' do
  it 'allure-rspec' do
    expect(true).to be_truthy
  end
end

Run result:

$ rspec spec/hello_spec.rb 
/var/lib/gems/2.1.0/gems/allure-rspec-0.7.7/lib/allure-rspec/formatter.rb:42:in `start': uninitialized constant AllureRSpec::Formatter::Pathname (NameError)
        from /var/lib/gems/2.1.0/gems/rspec-core-3.4.3/lib/rspec/core/reporter.rb:189:in `block in notify'
        from /var/lib/gems/2.1.0/gems/rspec-core-3.4.3/lib/rspec/core/reporter.rb:188:in `each'
        from /var/lib/gems/2.1.0/gems/rspec-core-3.4.3/lib/rspec/core/reporter.rb:188:in `notify'
        from /var/lib/gems/2.1.0/gems/rspec-core-3.4.3/lib/rspec/core/reporter.rb:88:in `start'
        from /var/lib/gems/2.1.0/gems/rspec-core-3.4.3/lib/rspec/core/reporter.rb:75:in `report'
        from /var/lib/gems/2.1.0/gems/rspec-core-3.4.3/lib/rspec/core/runner.rb:117:in `run_specs'
        from /var/lib/gems/2.1.0/gems/rspec-core-3.4.3/lib/rspec/core/runner.rb:93:in `run'
        from /var/lib/gems/2.1.0/gems/rspec-core-3.4.3/lib/rspec/core/runner.rb:78:in `run'
        from /var/lib/gems/2.1.0/gems/rspec-core-3.4.3/lib/rspec/core/runner.rb:45:in `invoke'
        from /var/lib/gems/2.1.0/gems/rspec-core-3.4.3/exe/rspec:4:in `<top (required)>'
        from /usr/local/bin/rspec:23:in `load'
        from /usr/local/bin/rspec:23:in `<main>'

The screenshot are not getting added to the xml file

I am using Selenium WebDriver, RSpec with Allure. I see all the data in the test report, the screenshot is getting saved to the specified location but is not getting attached to the xml.
Any inputs on what could be the issue?
Version of Allure-Rspec: 0.6.8

[BUG] Hook are not trigger in the good order

Hello !
I am facing this issue that the hook are not trigger in the good order.

spec_helper.rb

RSpec.configure do |config|
  config.include AllureRSpec::Adaptor

  config.before(:suite) do
    puts 'Before Suite Spec helper'
  end

  config.before(:all) do
    puts 'Before all Spec helper'
  end
end

foo_spec.rb

require 'spec_helper'

describe 'When I test allure rspec' do
  before(:all) do
    puts 'Before all in foo spec'
  end

  it 'should do something' do
    puts 'In the test'
    expect(true).not_to be_nil
  end
end

Current result ๐Ÿ‘Ž

Cleaning output directory 'gen/allure-results'...
Before Suite Spec helper
Before all in foo spec
Before all Spec helper
In the test

Expected result ๐Ÿ‘

Before Suite Spec helper
Before all Spec helper
Before all in foo spec
In the test

Can you please have a look at it ?

Thank you.

when will this support multi describe case?

i have some case like:

describe 'A' do
    describe 'AA' do
         it 'A should be able do AA' do
              "AA".should be_equal("AA")
         end
         describe 'AAA' do
             it 'A should be able do AA' do
                  "AAA".should be_equal("AAA")
             end
         end
    end
end

some case like that is a multi level tree like case

when i use this allure-rspec , this kind of case is not support to generate the report.
when did we schedule to support this?

Doesn't recognize examples was run as a shared_examples

I have a set of specs where is 256 examples total, but all of them just call through 'it_behaves_like' method, and use actually only 3 independent 'shared_examples'

So, when the report been generated using allure-cli I've got the one where said that I had only 3 test cases there
I'm able to provide more info (xml-files as well) if needed.
Thank You

Error when using the gem with latest version of RSpec (3.2)

Here is the error that we get with the latest version of rspec-core - 3.2.

C:/Ruby193/lib/ruby/gems/1.9.1/gems/allure-rspec-0.6.8/lib/allure-rspec/hooks.rb:18:in `block in hooks': undefined method `[]' for #<AllureRSpec::Hooks::OverrideHooksMethods::OverridenHookCollections:0x35e6ad0> (NoMethodError)
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/allure-rspec-0.6.8/lib/allure-rspec/hooks.rb:17:in `each'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/allure-rspec-0.6.8/lib/allure-rspec/hooks.rb:17:in `hooks'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-3.2.0/lib/rspec/core/hooks.rb:198:in `before'
    from c:/jenkins_slave/workspace/WSBNDRubySmoke/spec/integration/smoke_text_spec.rb:9:in `block in <top (required)>'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-3.2.0/lib/rspec/core/example_group.rb:363:in `module_exec'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-3.2.0/lib/rspec/core/example_group.rb:363:in `subclass'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-3.2.0/lib/rspec/core/example_group.rb:253:in `block in define_example_group_method'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-3.2.0/lib/rspec/core/dsl.rb:43:in `block in expose_example_group_alias'
    from c:/jenkins_slave/workspace/WSBNDRubySmoke/spec/integration/smoke_text_spec.rb:3:in `<top (required)>'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-3.2.0/lib/rspec/core/configuration.rb:1226:in `load'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-3.2.0/lib/rspec/core/configuration.rb:1226:in `block in load_spec_files'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-3.2.0/lib/rspec/core/configuration.rb:1224:in `each'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-3.2.0/lib/rspec/core/configuration.rb:1224:in `load_spec_files'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-3.2.0/lib/rspec/core/runner.rb:97:in `setup'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-3.2.0/lib/rspec/core/runner.rb:85:in `run'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-3.2.0/lib/rspec/core/runner.rb:70:in `run'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-3.2.0/lib/rspec/core/runner.rb:38:in `invoke'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-3.2.0/exe/rspec:4:in `<top (required)>'
    from C:/Ruby193/bin/rspec:23:in `load'
    from C:/Ruby193/bin/rspec:23:in `<main>'

Integrate the allure report into Rspec tests with Jenkins

Hi folks,

I am trying to integrate the allure report into Rspec tests with Jenkins, but the Jenkins Console output keep saying:

16:37:10 Exception in thread "main" ru.yandex.qatools.allure.data.ReportGenerationException: Could not find any allure results
16:37:10 	at ru.yandex.qatools.allure.data.AllureReportGenerator.generate(AllureReportGenerator.java:58)
16:37:10 	at ru.yandex.qatools.allure.data.AllureReportGenerator.generate(AllureReportGenerator.java:53)
16:37:10 	at ru.yandex.qatools.allure.AllureMain.main(AllureMain.java:48)
16:37:10 Command aborted due to exception {}.
16:37:10 org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
16:37:10 	at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)
16:37:10 	at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
16:37:10 	at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:153)
16:37:10 	at ru.yandex.qatools.allure.command.ReportGenerate.runUnsafe(ReportGenerate.java:48)
16:37:10 	at ru.yandex.qatools.allure.command.AbstractCommand.run(AbstractCommand.java:52)
16:37:10 	at ru.yandex.qatools.allure.CommandLine.main(CommandLine.java:46)
16:37:11 Starting web server for report directory <allure-report>
16:37:11 2017-06-21 16:37:11.343:INFO::main: Logging initialized @843ms
16:37:11 Can not open browser because this capability is not supported on your platform. You can use the link below to open the report manually.
16:37:11 Server started at <http://172.31.14.172:42798/>. Press <Ctrl+C> to exit ...

Here's the part of the command in the execute shell:

  bundle install
  bundle exec rake db:migrate
  export PATH=~/.yarn/bin:$PATH
  cd client && yarn install && npm run build && cd ..
  yarn install
  RAILS_ENV=test bin/webpack
  bundle exec rspec  
  allure generate allure-results/ -o allure-report/
  allure report open -o allure-report/

In our Ubuntu server, I can see 'allure-results' and 'allure-report' under the root of the project, but no xml files in them.
Under 'allure-results' folder, only 'executor.json' and 'testrun.json' exist;
and under 'allure-report', only 'data' and 'plugins' exist.

However, it runs perfectly on my local Mac 10.12. I'm using rspec 3.5.

Does anyone know how to solve this problem?

Your report seems to be broken! Check out our FAQ to find a reason Message: {{error.message || error.status}}

I am trying to debug this issue, where the report always has only this shown, I see the xml files though are correctly formatted and screenshots are also named correctly. Attached is a sample of the xml and generated report samples.
I was using an older version of the allure-rspec (0.7.1) with corresponding rspec (3.2). It was working perfectly fine but something recently started to cause it to fail. Upgrading to latest did not resolve the issue either. Does not seem to be related to allure-rspec but most like allure-cli which now is part of allure-core but did not find any ruby related information on that repo. Hence posting here, any pointers on this would be great.

log.zip

[Feature] add possibility to just point :story/:feature as independent param to test suite

I've faced that i write something like this:

describe 'Some feature', feature: 'Some feature' do
  describe 'Some story', story: 'Some story' do
    it 'does smth'
  end
  describe 'Some another story', story: 'Some another story' do
    it 'does smth other'
  end
end

If we just could to do something like this:

describe 'Some feature', :feature do
  describe 'Some story', :story do
    it 'does smth'
  end
end

we would have more clear and readable code. In this case you could to get value for this from the description of example_group. Of course we need to make current behavior available as well in case of we we have different values here
What you think?

attach_file is undefined

In v0.5.3 I can utilize 'attach_file [name], [file]' without any problems. After I just updated to v0.6.4 I continuously receive the error "undefined method 'attach_file' for..." The code I used before has not changed.

stack-trace is not clear:with inner rspec lib stack-trace in the head.

Given the rspec script:

require_relative 'spec_helper' #allure-rspec included.

describe 'zwh' do
   it 'hello' do
     expect(2).to eq(3)
   end
end

Then got the report xml's partial content:

<failure>
        <message>
expected: 3
     got: 2

(compared using ==)
</message>
        <stack-trace>/var/lib/gems/2.1.0/gems/rspec-support-3.3.0/lib/rspec/support.rb:86:in `block in &lt;module:Support&gt;'&#xD;
/var/lib/gems/2.1.0/gems/rspec-support-3.3.0/lib/rspec/support.rb:93:in `call'&#xD;
/var/lib/gems/2.1.0/gems/rspec-support-3.3.0/lib/rspec/support.rb:93:in `notify_failure'&#xD;
/var/lib/gems/2.1.0/gems/rspec-expectations-3.3.1/lib/rspec/expectations/fail_with.rb:27:in `fail_with'&#xD;
/var/lib/gems/2.1.0/gems/rspec-expectations-3.3.1/lib/rspec/expectations/handler.rb:38:in `handle_failure'&#xD;
/var/lib/gems/2.1.0/gems/rspec-expectations-3.3.1/lib/rspec/expectations/handler.rb:50:in `block in handle_matcher'&#xD;
/var/lib/gems/2.1.0/gems/rspec-expectations-3.3.1/lib/rspec/expectations/handler.rb:27:in `with_matcher'&#xD;
/var/lib/gems/2.1.0/gems/rspec-expectations-3.3.1/lib/rspec/expectations/handler.rb:48:in `handle_matcher'&#xD;
/var/lib/gems/2.1.0/gems/rspec-expectations-3.3.1/lib/rspec/expectations/expectation_target.rb:54:in `to'&#xD;
/home/wuhuizuo/apps/vmp4-0/src/spec/zwh_spec.rb:5:in `block (2 levels) in &lt;top (required)&gt;'&#xD;
/var/lib/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:206:in `instance_exec'&#xD;
/var/lib/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:206:in `block in run'&#xD;
/var/lib/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:430:in `block in with_around_and_singleton_context_hooks'&#xD;
/var/lib/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:388:in `block in with_around_example_hooks'&#xD;
/var/lib/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/hooks.rb:478:in `block in run'&#xD;
/var/lib/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/hooks.rb:616:in `run_around_example_hooks_for'&#xD;
/var/lib/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/hooks.rb:478:in `run'&#xD;
/var/lib/gems/2.1.0/gems/allure-rspec-0.7.4/lib/allure-rspec/hooks.rb:33:in `run'&#xD;
/var/lib/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:388:in `with_around_example_hooks'&#xD;
/var/lib/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:430:in `with_around_and_singleton_context_hooks'&#xD;
/var/lib/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:203:in `run'&#xD;
/var/lib/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example_group.rb:559:in `block in run_examples'&#xD;
/var/lib/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example_group.rb:555:in `map'&#xD;
/var/lib/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example_group.rb:555:in `run_examples'&#xD;
/var/lib/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example_group.rb:521:in `run'&#xD;
/var/lib/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:115:in `block (3 levels) in run_specs'&#xD;
/var/lib/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:115:in `map'&#xD;
/var/lib/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:115:in `block (2 levels) in run_specs'&#xD;
/var/lib/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb:1627:in `with_suite_hooks'&#xD;
/var/lib/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:114:in `block in run_specs'&#xD;
/var/lib/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/reporter.rb:77:in `report'&#xD;
/var/lib/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:113:in `run_specs'&#xD;
/var/lib/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:89:in `run'&#xD;
/var/lib/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:73:in `run'&#xD;
/var/lib/gems/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:41:in `invoke'&#xD;
/var/lib/gems/2.1.0/gems/rspec-core-3.3.2/exe/rspec:4:in `&lt;top (required)&gt;'&#xD;
/usr/local/bin/rspec:23:in `load'&#xD;
/usr/local/bin/rspec:23:in `&lt;main&gt;'</stack-trace>
      </failure>

But expected first stack-trace line is:

/home/wuhuizuo/apps/vmp4-0/src/spec/zwh_spec.rb:5:inblock (2 levels) in <top (required)>' `

If use the origin rspec gem, the first line of stack-trace is the expected line:

/home/wuhuizuo/apps/vmp4-0/src/spec/zwh_spec.rb:5:inblock (2 levels) in <top (required)>' `

parallel_tests overwriting test results

I recently implemented the parallel_tests gem (https://github.com/grosser/parallel_tests).

I'm running 8 parallel processes which generates 8 XML files. I was hoping that the test suites might combine in the report if the name was the same. The bigger problem for me is that each process is overwriting the previous test result. So, if I run 35 test cases across 8 processes, I'm only getting results for 8 test cases (1 per process).

Any ideas? Let me know if you need more detail.

screen shot 2014-08-11 at 1 36 36 pm

Handle multiple Rspec failures - error

After upgrading rspec 2.14 to 3.4 - now all examples(tests) are getting this error - Same as Issue #58
In the report it shows as broken.
The error is RSpec::Expectations::MultipleExpectationsNotMetError
No stacktrace or raw available from report

Set Example Status as Pending/Canceled/Broken

Is there a way to set the status of an example to Pending/Canceled/Broken? For examples that have existing bugs reported in our test management tool, I would like to set bypass running that example and set the status to Broken.

Nested steps are not supported

Currently nested steps are not possible because Ruby's Mutex doesn't allow reentrance, and every step internally is wrapped with one. You will get

deadlock; recursive locking

if you'll try to nest steps one into another

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.