Borja Tarraso
Borja Tarraso

Reputation: 883

Negate result of the test in robotframework

Is there any option to negate a test in robotframework? I have this specific chunk of code:

*** Settings ***
Library    SSHLibrary

*** Variables ***
${HOST}    localhost
${USER}    guest
${PASS}    guest

*** Test Cases ***
Verify default credentials are disabled
    Open Connection    ${HOST}
    Login              ${USER}    ${PASS}

This will PASS if test can connect and login using those credentials, however if it is required to ensure that some credentials are disabled/will not work, test should PASS in case cannot perform the connection.

Is there any way to negate the result of the test in robotframework?

Upvotes: 1

Views: 3079

Answers (1)

Pekka Klärck
Pekka Klärck

Reputation: 2428

Unless the library you use doesn't have suitable "negative keyword" such as Login Should Fail, which SSHLibrary doesn't have, you need a workaround. The easiest workaround is probably using BuiltIn keyword Run Keyword And Expect Error.

Upvotes: 3

Related Questions