简体   繁体   English

Watir,运行测试脚本后如何获取显示的错误并将其放置在文件上

[英]Watir, How can i fetch the errors it displays after running a test script and place it on a file

Im new to watir and running scripts from it. 我是watir的新手,并从中运行脚本。 Just want to ask if how can I get or extract the error messages Scite displays on the left panel and import it to a textfile? 只想问我如何获取或提取错误消息,在左侧面板上显示Scite并将其导入到文本文件中? or is it really possible to do? 还是真的有可能做? Thanks. 谢谢。

I am not sure how would you do it from Scite, but if you execute Watir script from command line, you can redirect output to file: 我不确定如何从Scite中执行此操作,但是如果您从命令行执行Watir脚本,则可以将输出重定向到文件:

$ ruby watir_script.rb > results.txt

If you use test framework like RSpec , there are a lot of options for storing test results in files. 如果使用RSpec之类的测试框架,则有很多选项可以将测试结果存储在文件中。

From Scite, you click in the output frame, Ctrl-A (to select all), Ctrl-C (to copy), then paste into what every application you like such as notepad. 在Scite中,单击输出框中的Ctrl-A(选择全部),Ctrl-C(复制),然后将其粘贴到所需的每个应用程序中,例如记事本。

I agree with Zeljko, you should use a good framework like rspec or testunit. 我同意Zeljko,您应该使用rspec或testunit之类的良好框架。 Goodluck. 祝好运。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM