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

Smart wait for "check if exists" / "row count" assertion keywords #209

Closed
amochin opened this issue Feb 13, 2024 · 0 comments
Closed

Smart wait for "check if exists" / "row count" assertion keywords #209

amochin opened this issue Feb 13, 2024 · 0 comments
Assignees
Milestone

Comments

@amochin
Copy link
Collaborator

amochin commented Feb 13, 2024

The assertion keywords like "Check if (not) exists" or "row count" would currently immediately fail if the intended check fails - which is basically as expected.
However, in real life it's often needed to wait, until some data appears / disappears in the DB - which takes some time.
This is typically solved with a high level keyword, which repeats the assertion multiple times (with a pause) until the assertion is passed or the timeout is reached.
Example:

Wait Row Present In Database
    [Arguments]    ${SQL}    ${Should Be Present}=True    ${Timeout}=2 Seconds
    ${done}=    Set Variable    ${False}
    WHILE    not $done    limit=${Timeout}
        ${results}=    Query    ${SQL Anfrage}
        IF    ${Should Be Present}
            ${done}=    Evaluate    len($results) > 0
        ELSE
            ${done}=    Evaluate    len($results) < 1
        END
        IF    not $done
            Sleep    0.1s
        END
    END
    RETURN    ${results}

It would be nice to include such kind of smart waiting directly in the library keywords.

@amochin amochin added this to the 1.5.0 milestone Feb 28, 2024
amochin added a commit that referenced this issue Aug 12, 2024
@amochin amochin self-assigned this Aug 13, 2024
@amochin amochin closed this as completed in d1f5b40 Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant