1
我正在使用TestRails在我們的自動化測試套件中記錄失敗。例如故障有這樣的輸出:從()之後的rspec輸出中獲取失敗/錯誤行
Failures:
1) can click on the Photos button after logging in
Failure/Error: login.signin_btn.click
NoMethodError:
undefined method `click' for nil:NilClass
# /Users/kkrzeminski/TestApp/Appium/Common/pages_helper.rb:36:in `click'
# ./test_1_spec.rb:9:in `block (2 levels) in <top (required)>'
我能搶在after(:each)
塊使用example.exception
異常在我spec_helper
,以及回溯,但什麼我真正感興趣的是與Failure/Error:
開始該行。我似乎無法找到獲取該字符串的方法。在TestRails中記錄測試失敗的原因是很方便的,因爲只有異常和回溯不是非常具有描述性。
要添加到Aaron所說的內容中,故障/錯誤行顯示爲格式化程序通知中的message_lines的第一行:https://github.com/rspec/rspec-core/blob/v3。 2.3/LIB/rspec的/核心/ notifications.rb#L162-L167 –