Skip to content

Commit

Permalink
Bug fix/not showing proc name (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
nk-ty authored Mar 16, 2020
2 parents a6a789d + 4bc692a commit 6ca66d3
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 19 deletions.
6 changes: 3 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
bucky-core (0.10.2)
bucky-core (0.10.3)
addressable (~> 2.5)
color_echo (~> 3.1)
json (~> 2.1)
Expand Down Expand Up @@ -34,12 +34,12 @@ GEM
json (2.1.0)
method_source (0.9.0)
mini_portile2 (2.4.0)
nokogiri (1.10.8)
nokogiri (1.10.9)
mini_portile2 (~> 2.4.0)
parallel (1.12.1)
parser (2.6.3.0)
ast (~> 2.4.0)
power_assert (1.1.5)
power_assert (1.1.6)
pry (0.11.3)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
Expand Down
2 changes: 1 addition & 1 deletion lib/bucky/core/test_core/test_class_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def add_test_procedure(procedures)
procedure[:proc] ||= ''.dup
puts " #{step_number}:#{procedure[:proc]}"
method = procedure[:exec].key?(:operate) ? :operate : :verify
send(method, exec: procedure[:exec], step_number: step_number)
send(method, exec: procedure[:exec], step_number: step_number, proc_name: procedure[:proc])
end
end

Expand Down
4 changes: 2 additions & 2 deletions lib/bucky/test_equipment/test_case/e2e_test_case.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ def t_equip_setup
end

# Call mothod of verification
# @param [Hash] verify_args e.g.) {:exec=>{verify: "assert_title", expect: "page title"}, :step_number=> 1}
# @param [Hash] verify_args e.g.) {:exec=>{verify: "assert_title", expect: "page title"}, :step_number=> 1, :proc_name=> "test proc"}
def verify(**verify_args)
@service_verifications.send(verify_args[:exec][:verify], verify_args)
end

# Call method of user operation
# @param [Hash] op_args e.g.) {:exec=>{:operate=>"click", :page=>"top_page", :part=>"fizz_button"}, :step_number=> 1}
# @param [Hash] op_args e.g.) {:exec=>{:operate=>"click", :page=>"top_page", :part=>"fizz_button"}, :step_number=> 1, :proc_name=> "test proc"}
def operate(**op_args)
@user_operator.send(op_args[:exec][:operate], method_name, op_args)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/bucky/test_equipment/user_operation/user_operator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def method_missing(operation, test_case_name, **args)
# Call method of part
part_mothod(args[:exec]) if args[:exec].key?(:part)
rescue StandardError => e
Bucky::Core::Exception::WebdriverException.handle(e, "#{args[:step_number]}:#{args[:exec][:proc]}")
Bucky::Core::Exception::WebdriverException.handle(e, "#{args[:step_number]}:#{args[:proc_name]}")
end

private
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def method_missing(verification, **args)
raise StandardError, "Undefined verification method or invalid arguments. #{verification},#{args[:exec]}"
end
rescue StandardError => e
Bucky::Core::Exception::WebdriverException.handle(e, "#{args[:step_number]}:#{args[:exec][:proc]}")
Bucky::Core::Exception::WebdriverException.handle(e, "#{args[:step_number]}:#{args[:proc_name]}")
end

private
Expand Down
4 changes: 2 additions & 2 deletions spec/test_equipment/test_case/e2e_test_case_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

describe '#verify' do
let(:verification_double) { double('verification double') }
let(:verify_args) { { exec: { verify: 'assert_title', expect: 'page title' }, step_number: 1 } }
let(:verify_args) { { exec: { verify: 'assert_title', expect: 'page title' }, step_number: 1, proc_name: 'test proc' } }
before do
allow(subject).to receive(:create_webdriver)
allow(Bucky::TestEquipment::Verifications::ServiceVerifications).to receive(:new).and_return(verification_double)
Expand All @@ -60,7 +60,7 @@

describe '#operate' do
let(:user_operator_double) { double('user_operator double') }
let(:op_args) { { exec: { operate: 'click', page: 'top', part: { locate: 'rosen_tokyo', num: 1 } }, step_number: 1 } }
let(:op_args) { { exec: { operate: 'click', page: 'top', part: { locate: 'rosen_tokyo', num: 1 } }, step_number: 1, proc_name: 'test proc' } }
before do
allow(subject).to receive(:create_webdriver)
allow(Bucky::TestEquipment::Verifications::ServiceVerifications).to receive(:new)
Expand Down
12 changes: 6 additions & 6 deletions spec/test_equipment/user_operation/user_operator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
context 'when call method of operation helper' do
let(:operation_helper_methods?) { true }
let(:operation) { :go }
let(:operation_args) { { exec: { operation: 'go' }, step_number: 1 } }
let(:operation_args) { { exec: { operation: 'go' }, step_number: 1, proc_name: 'test proc' } }
it 'call operation_helper.send' do
expect(user_operation_helper_double).to receive(:send)
subject.send(operation, 'test_method_name', operation_args)
Expand All @@ -31,7 +31,7 @@
let(:part_double) { double('part double') }
let(:operation_helper_methods?) { false }
let(:operation) { :go }
let(:operation_args) { { exec: { operation: 'go' }, step_number: 1 } }
let(:operation_args) { { exec: { operation: 'go' }, step_number: 1, proc_name: 'test proc' } }

it 'not call operation_helper.send' do
expect(user_operation_helper_double).not_to receive(:send)
Expand All @@ -40,7 +40,7 @@

context 'when call method of pageobject' do
let(:operation) { :input_inquire_info }
let(:operation_args) { { exec: { page: 'top', operate: 'input_inquire_info' }, step_number: 1 } }
let(:operation_args) { { exec: { page: 'top', operate: 'input_inquire_info' }, step_number: 1, proc_name: 'test proc' } }
it 'call pageobject.send' do
allow(pages_double).to receive(:send).and_return(page_double)
expect(page_double).to receive(:send)
Expand All @@ -50,7 +50,7 @@
context 'when call method of part' do
let(:operation) { :click }
context 'in case single part' do
let(:operation_args) { { exec: { page: 'top', part: 'rosen_tokyo' }, step_number: 1 } }
let(:operation_args) { { exec: { page: 'top', part: 'rosen_tokyo' }, step_number: 1, proc_name: 'test proc' } }
it 'call send of part object' do
allow(pages_double).to receive(:send).and_return(page_double)
allow(page_double).to receive(:send).and_return(part_double)
Expand All @@ -59,7 +59,7 @@
end
end
context 'in case operate one part of multiple parts' do
let(:operation_args) { { exec: { page: 'top', part: { locate: 'rosen_tokyo', num: 1 } }, step_number: 1 } }
let(:operation_args) { { exec: { page: 'top', part: { locate: 'rosen_tokyo', num: 1 } }, step_number: 1, proc_name: 'test proc' } }
let(:parts_double) { double('parts double') }
it 'call send of part object' do
allow(pages_double).to receive(:send).and_return(page_double)
Expand All @@ -74,7 +74,7 @@
context 'when raise exception' do
let(:operation_helper_methods?) { true }
let(:operation) { :go }
let(:operation_args) { { exec: { operation: 'go' }, step_number: 1 } }
let(:operation_args) { { exec: { operation: 'go' }, step_number: 1, proc_name: 'test proc' } }
let(:exception) { StandardError }
it 'call WebdrverException.handle' do
allow(user_operation_helper_double).to receive(:send).and_raise(exception)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
end

describe '#method_missing' do
let(:verify_args) { { exec: { verify: 'assert_title', expect: 'page title' }, step_number: 1 } }
let(:verify_page_args) { { exec: { page: page_name, verify: 'assert_sample', expect: 'page title' }, step_number: 1 } }
let(:dummy_verify_args) { { exec: { verify: 'hoge', expect: 'hoge' }, step_number: 1 } }
let(:verify_args) { { exec: { verify: 'assert_title', expect: 'page title' }, step_number: 1, proc_name: 'test proc' } }
let(:verify_page_args) { { exec: { page: page_name, verify: 'assert_sample', expect: 'page title' }, step_number: 1, proc_name: 'test proc' } }
let(:dummy_verify_args) { { exec: { verify: 'hoge', expect: 'hoge' }, step_number: 1, proc_name: 'test proc' } }
let(:page_method_double) { double('page method') }
before do
allow(Bucky::TestEquipment::Verifications::E2eVerification).to receive(:new).and_return(e2e_verification)
Expand Down

0 comments on commit 6ca66d3

Please sign in to comment.