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

How to use for testing TUIs? #137

Open
yajo opened this issue Sep 28, 2020 · 1 comment
Open

How to use for testing TUIs? #137

yajo opened this issue Sep 28, 2020 · 1 comment

Comments

@yajo
Copy link

yajo commented Sep 28, 2020

Hi there.

I'd love to see an example on how to use this to test a TUI.

Particularly, my project uses https://github.com/tmbo/questionary to ask questions to the user and print a TUI to choose the answers.

I'd love to be able to emulate user interaction, know the messages he's seeing in the screen, emulate some keypress events, read next question, say next answer, etc.

I've been trying to get my head around how to use pyte for this purpose and I'm pretty sure it's possible, but I can't get to how. I'd like something like this pseudocode:

my_process = ['copier', 'copy', src_path, dst_path]
with some_magic_from_pyte(my_process) as input, screen:
    assert 'do_you_love_me?' in screen.display
    input.send('y')
    assert 'your_name?' in screen.display
    input.send('yajo\r')
    assert my_process_did_what_it_had_to_do()

Any help on how to do something similar please? 🙏 😇

@AlvinKuruvilla
Copy link

I have a similar use case. I would love to use this as part of an automated testing/fuzzing setup

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

2 participants