1
votes

When a test case in Robotframework FAILs I am able to log "Test Message" in report with FAIL keyword:

FAIL     *HTML* Log Link : <a href="data.txt">Data</a>

But how can I log the same on case of test PASS case criteria, I am not sure but should we use "Pass Execution" keyword - it states - Skips rest of the current test, setup, or teardown with PASS status - but I have teardown steps - so should we make use of Pass Execution keyword in test case body.

Log to Console logs only to standard output and is not captured in "Message" report.html while FAIL msg gets displayed in "Message"

Please let me know how to use PASS with message with just stating that the test cases was success and complete its teardown

enter image description here

1
Have you tried the log keyword? Why does that not work for you? - Bryan Oakley
Log has levels and it can be set as NONE or needs to be reset once my test case execution is done. - Programmer

1 Answers

0
votes

I am not sure but should we use "Pass Execution" keyword - it states - Skips rest of the current test, setup, or teardown with PASS status - but I have teardown steps - so should we make use of Pass Execution keyword in the test case body.

If you use Pass Execution in the body of a test case, your teardown steps will still run. The documentation is trying to point out that if you use Pass Execution inside a teardown, the teardown will stop at the point that you call the keyword.

You can see this with a very simple example. Even though the following test calls Pass execution, both the suite teardown and test teardown will add messages to the log.

*** Settings ***
Suite Teardown   log  the suite teardown was called

*** Test Cases ***
Example
    [Teardown]  log  the test teardown was called

    Should be equal  test  test
    Pass execution  Looking good Bill Ray!

log.html excerpt

If you want to explicitly set the test message, you can use the built-in keyword Set test message. It will change the test message for a passing test.

*** Test cases ***
Example
    Should be equal  test  test
    Set test message  Looking good Billy Ray!