[英]Python doesn't log into Robot framework log.html
Trying to log from my test script into the log.html of robot framework. 尝试从我的测试脚本登录到机器人框架的log.html。 I simply cannot make it work... 我根本无法让它发挥作用......
I have read the docs ... http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#logging-information 我已经阅读了文档... http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#logging-information
But still nothing inside the log.html besides the test reports. 但除了测试报告外,log.html内部仍然没有任何内容。 What am I missing? 我错过了什么?
I have tried the following: 我尝试过以下方法:
print "output: " + "something"
logger.console("something")
logging.info("something")
sys.__stdout__.write('Got arg %s\n' % "something")
print "something"
logger.info("output: " + "something")
The test is run like this: 测试运行如下:
*** Settings ***
Library Process
*** Test Cases ***
First test
${result} = Run Process python createCommunityTest/createCommunityTest.py
Should Be Equal As Integers ${result.rc} 0
You won't get the process'es output in the log just like that; 您不会像这样在日志中获得进程输出; the Run Process
returns a result object , and one of its attributes is stdout
. Run Process
返回一个结果对象 ,其中一个属性是stdout
。 So to see it (in the logs), add this 所以要查看它(在日志中),添加它
Log ${result.stdout}
There's also an attribute for the stderr
output. stderr
输出还有一个属性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.