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

Read Until discards read data on failed test #21

Open
EdwinFairchild opened this issue Oct 28, 2022 · 1 comment
Open

Read Until discards read data on failed test #21

EdwinFairchild opened this issue Oct 28, 2022 · 1 comment

Comments

@EdwinFairchild
Copy link

EdwinFairchild commented Oct 28, 2022

I am using Read Until extensively in my testing, however on failed tests I do not have any way of knowing what the serial output was. All I know is that it did not find what it was expecting. For some cases seeing what was sent during a failed test can greatly help debug.

Python not being my forte, I have been trying to implement something with the same functionality as Read Until but have it also return the data.
I have had no luck. Can you provide some insight as to how you would accomplish this?

@EdwinFairchild EdwinFairchild changed the title Read Until dumps read data Read Until discards read data on failed test Oct 28, 2022
@EdwinFairchild
Copy link
Author

Best I could do was this Expect And Timeout keyword which passes the NONE parameter in place of a delimiter which according do the code causes Read Until to read until a LF is received. At which point I log that data and then check if it contains my expected string.

Expect And Timeout
    [Arguments]    ${data}    ${timeout}    ${port}    
    [Timeout]    ${timeout}
    ${EMPTY}=    Set Variable    ""
    Log To Console    \n
    WHILE    True    limit=500000
        ${source}=    Read Until   NONE    NONE    NONE    ${port}
        Log To Console    ${source}
        ${contains}=    Run Keyword And Return Status    Should Contain    ${source}    ${data}
        IF    ${contains}
            Pass Execution    ------------------------------------------------------------------------------
        END
    END
    Fail    "Test Failed"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant