1

Trying to log from my test script into the log.html of robot framework. I simply cannot make it work...

I have read the docs ... http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#logging-information

But still nothing inside the log.html besides the test reports. 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
3
  • Is createCommunityTest supposed to be a library with robot keywords, or is it a script? Commented Aug 25, 2017 at 12:15
  • It's a python script. Commented Aug 25, 2017 at 12:22
  • When you run a Python script as a shell Process that makes RF captures all outputs. But if you call your Python script as an RF Library then you have more control. Commented Jan 9, 2020 at 18:35

1 Answer 1

3

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. So to see it (in the logs), add this

Log     ${result.stdout}

There's also an attribute for the stderr output.

Sign up to request clarification or add additional context in comments.

2 Comments

For some reason it still doesn't log when tests are failing
If it fails before getting to the Log statement, it's natural - it won't be executed; if that's not the case, please share your code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.