差異處
這裏顯示兩個版本的差異處。
rf:rf:basic:set_test_message [2019/07/08 13:20] tony |
rf:rf:basic:set_test_message [2023/06/25 09:48] |
||
---|---|---|---|
行 1: | 行 1: | ||
- | {{tag>RobotFramework}} | ||
- | ====== RobotFramework - How to set message of report? ====== | ||
- | ===== Problem ===== | ||
- | 某些測試即使測試通過後,我會希望在報表上顯示出某些訊息。例如效能測試,我會希望在報表中顯示出expect與real的數值。然而在預設情況下,Test Pass的報表是不會有Message內容的:\\ | ||
- | {{:rf:rf:basic:rf_ok_report_without_msg.png|}}\\ | ||
- | \\ | ||
- | 本篇文章分享如何在Test Pass報表中,顯示出你想要的訊息。 | ||
- | ===== How to? ===== | ||
- | 我發現在Robot builtin keyword中,有一個叫[[http://robotframework.org/robotframework/latest/libraries/BuiltIn.html#Set%20Test%20Message|Set Log Message]]的keyword,經過嘗試可以做到我想要的: | ||
- | <code bash> | ||
- | Set Test Message | Test Message | ||
- | </code> | ||
- | 結果如下:\\ | ||
- | {{:rf:rf:basic:rf_ok_report_with_msg.png|}}\\ | ||
- | \\ | ||
- | 假如希望append訊息上去,可以使用 | ||
- | <code bash> | ||
- | Set Test Message | Test Message | append=yes | ||
- | </code> | ||
- | 使用這種方式,假如真的發生錯誤,也不用擔心最後message無法顯示出該有的錯誤訊息。 | ||
- | ===== Reference ===== | ||
- | * [[http://robotframework.org/robotframework/latest/libraries/BuiltIn.html#Set%20Test%20Message|BuiltIn Library Document]] | ||
- | ===== ===== | ||
- | ---- | ||
- | \\ | ||
- | ~~DISQUS~~ |