简体   繁体   English

Robot Framework Telnet保存整个会话日志

[英]Robot Framework Telnet save entire session log

I'm using Telnet library to operate and configure my DUT during the testing, it includes writing and reading from the terminal periodically. 我在测试过程中使用Telnet库操作和配置我的DUT,它包括定期从终端进行写入和读取。 I'm looking how to save all the session from the beginning and till the end when the test execution is finished. 我正在寻找如何在测试执行完成时从头到尾保存所有会话。

Once you instantiate Telnet object, you can call its read_all() function to get complete log: 实例化Telnet对象后,可以调用其read_all()函数以获取完整的日志:

from telnetlib import Telnet
tn = Telnet('http://example.com',80)
out = tn.read_all()

with open("File.txt", "wb") as f:
    f.write(out)

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

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