差異處
這裏顯示兩個版本的差異處。
下次修改 | 前次修改 | ||
rf:rf:basic:set_test_message [2019/07/08 12:04] tony 建立 |
rf:rf:basic:set_test_message [2019/07/08 13:20] tony |
||
---|---|---|---|
行 1: | 行 1: | ||
{{tag>RobotFramework}} | {{tag>RobotFramework}} | ||
- | ====== How to set message of report? ====== | + | ====== RobotFramework - How to set message of report? ====== |
===== Problem ===== | ===== Problem ===== | ||
某些測試即使測試通過後,我會希望在報表上顯示出某些訊息。例如效能測試,我會希望在報表中顯示出expect與real的數值。然而在預設情況下,Test Pass的報表是不會有Message內容的:\\ | 某些測試即使測試通過後,我會希望在報表上顯示出某些訊息。例如效能測試,我會希望在報表中顯示出expect與real的數值。然而在預設情況下,Test Pass的報表是不會有Message內容的:\\ | ||
行 7: | 行 7: | ||
本篇文章分享如何在Test Pass報表中,顯示出你想要的訊息。 | 本篇文章分享如何在Test Pass報表中,顯示出你想要的訊息。 | ||
===== How to? ===== | ===== 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~~ |