Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugger incorrectly Highlights every assertion error that has occurred in a debugger if the test case a whole fails #575

Closed
Serhiy1 opened this issue Feb 15, 2022 · 5 comments
Labels
bug Something isn't working robotframework-ls

Comments

@Serhiy1
Copy link

Serhiy1 commented Feb 15, 2022

Describe the bug
The Codebase that I work on has a lot of Polling, waiting for certain conditions to become true. This is mainly achieved through the use of keywords Run Keyword And Ignore Error and Wait Until Keyword Succeeds

This polling makes it extremely difficult to use the debugger. A whole load of noise will be introduced if the test case I'm working on fails on an assertion that happens after the polling.

To Reproduce
To help explain the pain I have made this small reproducible

*** Test Cases ***
Debugger Example
    ${_counter}=    Convert To Integer    1
    Set Suite Variable    ${COUNTER}    ${_counter}

    ${data}    ${status}=    Run Keyword And Ignore Error    Keyword Will Fail
    ${data}=    Wait Until Keyword Succeeds    5    1s    Poll Keyword

    Fail

*** Keywords ***
Keyword Will Fail
    [Documentation]    Example of failing keyword
    Fail

Poll Keyword
    [Documentation]    Example of polling keyword
    IF    ${COUNTER} == 5
        Return From Keyword    pass
    ELSE
        Set Suite Variable    ${COUNTER}    ${COUNTER+1}
        Fail
    END

This is the output of the debugger when run:
image

Expected behavior

Ideally, I would prefer that the debugger ignored all the assertion errors that were captured and handled and only highlighted the line that caused the test to fail

Additionally, when Running debugging the test, with the break on FAIL option enabled, This code will break on every single fail, which makes the feature not very helpful in this context.

@Serhiy1 Serhiy1 added bug Something isn't working robotframework-ls labels Feb 15, 2022
@fabioz
Copy link
Collaborator

fabioz commented Feb 15, 2022

I agree, that really seems annoying... it seems we need to have something akin to the handled / unhandled failures/errors (right now the feature is really stop on any handled exception and not just on the unhandled ones).

@Serhiy1
Copy link
Author

Serhiy1 commented Feb 15, 2022

I think this issue will also apply to the new TRY .... EXCEPT Syntax that will be introduced in RF 5.0.

@fabioz
Copy link
Collaborator

fabioz commented Feb 15, 2022

Yes, I was taking a look at the RF source code and it doesn't really provide any API to know whether a given error is the one that'd make the test fail (the main problem is that the debugger needs to stop at the Fail call and not later on when the test fails because that'd be too late to inspect variables as the state may have already changed).

What do you think about having something as a way to automatically ignore failures inside some keywords?

That way it'd ignore failures inside of keywords such as Run Keyword and Ignore Error and Wait Until Keyword Succeeds -- note: you would still be able to extend that for framework-specific calls as needed.

@fabioz
Copy link
Collaborator

fabioz commented Feb 15, 2022

For the TRY..EXCEPT it should be presumably simpler because the model should have the information on when it would need to stop (unlike keywords where this information is not available).

@Serhiy1
Copy link
Author

Serhiy1 commented Feb 15, 2022

What do you think about having something as a way to automatically ignore failures inside some keywords?

Yeah, I don't mind that. Personally, I don't see any reason to see the failures in these keywords, Unless they timeout.

Though I can't speak for everyone, and they want the behaviour to be togglable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working robotframework-ls
Projects
None yet
Development

No branches or pull requests

2 participants