Skip to content

Bug: Getting Error when using keyword arguments for allure step method #549

@samuel-anbudaiyan

Description

@samuel-anbudaiyan

Getting the below error for the below function call

step("Get jobs")
def self.get_jobs(a: , b: , c: )
  puts a,b,c
end
ArgumentError:
       wrong number of arguments (given 1, expected 0; required keywords: a, b, c)
     # ./qe/service/s3.rb:24:in `get_jobs'
     # /Users/sam/.rvm/gems/ruby-3.0.0/gems/allure-ruby-commons-2.24.4/lib/allure_ruby_commons/step_annotation.rb:24:in `call'
     # /Users/sam/.rvm/gems/ruby-3.0.0/gems/allure-ruby-commons-2.24.4/lib/allure_ruby_commons/step_annotation.rb:24:in `block (2 levels) in singleton_method_added'
     # /Users/sam/.rvm/gems/ruby-3.0.0/gems/allure-ruby-commons-2.24.4/lib/allure-ruby-commons.rb:224:in `run_step'
     # /Users/sam/.rvm/gems/ruby-3.0.0/gems/allure-ruby-commons-2.24.4/lib/allure_ruby_commons/step_annotation.rb:24:in `block in singleton_method_added'
     # ./spec/platform/alr/alr_s3_spec.rb:72:in `block (4 levels) in <top (required)>'
     # /Users/sam/.rvm/gems/ruby-3.0.0/gems/allure-ruby-commons-2.24.4/lib/allure-ruby-commons.rb:224:in `run_step'
     # ./spec/platform/alr/alr_s3_spec.rb:66:in `block (3 levels) in <top (required)>'
     # ./spec/spec_helper.rb:109:in `block (2 levels) in <top (required)>'
     # /Users/sam/.rvm/gems/ruby-3.0.0/gems/rspec-retry-0.6.2/lib/rspec/retry.rb:124:in `block in run'
     # /Users/sam/.rvm/gems/ruby-3.0.0/gems/rspec-retry-0.6.2/lib/rspec/retry.rb:110:in `loop'
     # /Users/sam/.rvm/gems/ruby-3.0.0/gems/rspec-retry-0.6.2/lib/rspec/retry.rb:110:in `run'
     # /Users/sam/.rvm/gems/ruby-3.0.0/gems/rspec-retry-0.6.2/lib/rspec_ext/rspec_ext.rb:12:in `run_with_retry'
     # ./spec/spec_helper.rb:72:in `block (2 levels) in <top (required)>'
     # /Users/sam/.rvm/gems/ruby-3.0.0/gems/rspec-retry-0.6.2/lib/rspec/retry.rb:124:in `block in run'
     # /Users/sam/.rvm/gems/ruby-3.0.0/gems/rspec-retry-0.6.2/lib/rspec/retry.rb:110:in `loop'
     # /Users/sam/.rvm/gems/ruby-3.0.0/gems/rspec-retry-0.6.2/lib/rspec/retry.rb:110:in `run'
     # /Users/sam/.rvm/gems/ruby-3.0.0/gems/rspec-retry-0.6.2/lib/rspec_ext/rspec_ext.rb:12:in `run_with_retry'
     # /Users/sam/.rvm/gems/ruby-3.0.0/gems/rspec-retry-0.6.2/lib/rspec/retry.rb:37:in `block (2 levels) in setup'

Checked how the params is being taken using the below code

puts method(:get_jobs)

Output:
#<Method: get_jobs(*args, &block) /Users/sam/.rvm/gems/ruby-3.0.0/gems/allure-ruby-commons-2.24.4/lib/allure_ruby_commons/step_annotation.rb:23>

It seems that is taking *args and not a:, b:, c:. But commenting the step method works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions