Programmer
Programmer

Reputation: 8717

PASS and Log HTML Message after succeessful execution of test case

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

Upvotes: 1

Views: 1229

Answers (1)

Bryan Oakley
Bryan Oakley

Reputation: 385980

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!

Upvotes: 0

Related Questions