1
votes

In robot testing, how do I pass user input for scripts which prompt for user confirmation? While testing manually, I enter yes or no kind of input to the scripts which prompt for user confirmation. How do I acheive the same in robot? I already tried using echo in robot test case, for ex: $ echo yes | myScript.pl

This works fine and accepts user input as yes, but it fails to read "yes" from the pipe when myScript.pl executes a command using ssh on a remote server and returns to the main script myScript.pl. After returning, the script fails to read "yes" from the pipe.

Is there any built in function of robot framework that can help here? or any other alternative?

Thanks.

1

1 Answers

0
votes

There is a commend called yes which will repeatedly input "yes" until killed. If that doesn't work either, try using expect.

yes|./myScript.pl

or using expect

#!/usr/bin/expect -f
spawn ./myScript.pl
expect "yes/NO"
send "yes\r"