Skip to content

allure step doesn't work if is used in global before :all hook #421

@emaks

Description

@emaks

I use
allure-rspec 2.17.0
rspec 3.11.0

STR

  • configure allure and rspec
AllureRspec.configure do |config|
  config.results_directory = "report/allure-results"
  config.clean_results_directory = true
  config.logging_level = Logger::WARN

  logger = Logger.new($stdout)
  logger.sev_threshold = Logger::WARN
  config.logger = logger
end
RSpec.configure do |config|
  # Enable flags like --only-failures and --next-failure
  config.example_status_persistence_file_path = ".rspec_status"

  # Disable RSpec exposing methods globally on `Module` and `main`
  config.disable_monkey_patching!

  config.expect_with :rspec do |c|
    c.syntax = :expect
  end
end
  • create test method
class TestUtils
  extend AllureStepAnnotation

  step("do something")
  def do_something
    # do something
  end
end
  • Use this method in before
RSpec.describe Tests do
  before :all do
    TestUtils.new.do_something
  end

  describe "describe_1" do
    it "test_1" do
      # test something
    end
  end
end

Result:

There is no "do something" step in Allure report

Also see errors in console

E, [2022-08-25T16:37:56.794116 #8687] ERROR -- : Could not start test step, no test case is running
E, [2022-08-25T16:37:56.794143 #8687] ERROR -- : Could not start test step, no test case is running

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementImprovement or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions