Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Robot framework: do print statements actually get output anywhere?

When a keyword has a print statements, does that output actually go anywhere when the test is run? for example:

Lib.py

def message(msg):
  print 'your message is ' + msg
  return True

Tests.robot

*** Settings ***
Library    Lib

*** Test Cases ***
Case1
    message    "hello"

If I run pybot Tests.robot, is there anywhere I can see the 'your message is hello' get printed, or does that output just go nowhere?

like image 458
ewok Avatar asked Mar 14 '23 18:03

ewok


1 Answers

Yes, they are captured and entered as LOG entries into the output.

After you run your test, open the log.html, go to the entry where your libraries keyword is called, and you will see a LOG entry with the output of your print statement in it.

RobotFramework Library Logging Information

Logging information

Exception messages are not the only way to give information to the users. In addition to them, methods can also send messages to log files simply by writing to the standard output stream (stdout) or to the standard error stream (stderr), and they can even use different log levels. Another, and often better, logging possibility is using the programmatic logging APIs.

like image 124
Kenneth E. Bellock Avatar answered Apr 08 '23 06:04

Kenneth E. Bellock