로그 파일에 오류 메시지가 있는지 확인하고 있습니다. 로그 파일에 오류 메시지가있는 경우 'raise'문을 사용하여 창을 인쇄하고 다음 로그 파일을 계속 확인합니다. 오류 메시지가 로그 파일에서 발견되면 Cucumber는 여전히 단계가 통과되었음을 나타냅니다. 단계 실패를 표시하는 방법을 알고 싶습니다. 실행이 끝날 때 인쇄합니다 (예 : 2 시나리오 (1 실패, 1 통과) 4 단계 (1 실패, 3 통과)). 어떤 도움을 주시면 감사하겠습니다!오이에서 단계 실패를 표시하는 방법?
Scenario: Running rake test
Given the system is installed
Then I run the rake test
logs_all = s.sudo "egrep -i '#{error_message}' #{log_file}"
logs_all.each do |hostname, logs|
unless logs.empty?
puts line, "Unhappy logs on #{hostname}", line, logs
happy = false
end
begin
raise "Unhappy logs found! in #{log_file}" unless happy
rescue StandardError => error
puts error.message
end
end