How do you interpret information in the RETURN section of Log Level TRACE in the log report?

My goal is to better understand the log file TRACE section RETURN. I have found that at times I get a test that is false positive. I wish to eliminate this type of result.

Test 1: I want to validate that a checkbox is selected.
Checkbox Should Be Selected //*[@ID=“blah”]
Test passes
Trace Results section of Log file reflects:
TRACE Return: None

Test 2: I want to compare two dates to see if equal.
Should Be Equal ${date1} ${date2}
Test passes
Trace Results section of Log file reflects:
TRACE Return: ‘2022/10/19’

For test 1 What does Return: None mean?
For Test 2 I understand the return and both variables have the same value so I agree test passes

Hi,

The keyword works like an assertion and not a question if I’m not mistaken (I don’t use seleniumlibrary)

So, if you wanted a return here rather than none for what your seeing, you could pair it with a keyword from the builtin library, for which the keyword Run Keyword And Return Status is probably what you’d be looking for, in which converts the pass/fail into a True/False return flag, and just incase you’ve not used builtin keywords before, these are always available as a standard library, so you shouldn’t need to do anything.

You could also write the locator as id:blah never actually seen @id in an XPath in uppercase “@ID

Hope that helps to possibly answer your question.

Note: always worth noting the library/s you are using in future posts.

1 Like

Hi,
My question pertains to the output log file and not specific to a library. When you run tests and have an output file there is a RETURN section. It is that section within then file I am trying to better understand.
Thanks
image

Hi Barry,

When you run you robot with --loglevel TRACE e.g.

robot --loglevel TRACE barrys.robot 

the trace data gets stored in the output.xml file (the HTML files are not generated until after the test finishes)

An example of this is this line from output.xml

<msg timestamp="20230330 12:01:41.687" level="TRACE">Return: None</msg>

Then when the HTML files are generated, no there’s no trace information in report.html as this is just a summary of the test results, but you will see it in the log.html

First hint is the Log level drop down:
image
This doesn’t appear when you run robot without specifying an increased log level. if you want a way to pragmatically detect if trace was on in a test, you could use xpaths like:

  • //msg[@level="TRACE"] on output.xml
  • //div[@id="log-level-selector"]//option[@value=0] on log.html

Hope that helps,

Dave.