Unix and Linux Discussions Tagged with expect |
|
Thread / Thread Starter |
Last Post |
Replies |
Views |
Forum |
|
|
|
0 |
20,535 |
UNIX for Beginners Questions & Answers |
|
|
|
1 |
5,183 |
UNIX for Beginners Questions & Answers |
|
|
|
3 |
8,938 |
Shell Programming and Scripting |
|
|
|
3 |
5,917 |
Shell Programming and Scripting |
|
|
|
2 |
3,188 |
UNIX for Beginners Questions & Answers |
|
|
|
1 |
7,882 |
UNIX for Beginners Questions & Answers |
|
|
|
1 |
1,518 |
UNIX for Beginners Questions & Answers |
|
|
|
7 |
1,734 |
UNIX for Beginners Questions & Answers |
|
|
|
1 |
1,156 |
UNIX for Beginners Questions & Answers |
|
|
|
3 |
3,883 |
Shell Programming and Scripting |
|
|
|
2 |
1,251 |
UNIX for Beginners Questions & Answers |
|
|
|
6 |
3,917 |
Shell Programming and Scripting |
|
|
|
1 |
4,260 |
Ubuntu |
|
|
|
0 |
6,595 |
Shell Programming and Scripting |
|
|
|
0 |
3,484 |
Shell Programming and Scripting |
|
|
|
2 |
6,783 |
Shell Programming and Scripting |
|
|
|
2 |
2,741 |
Shell Programming and Scripting |
|
|
|
7 |
7,180 |
Shell Programming and Scripting |
|
|
|
1 |
5,503 |
Shell Programming and Scripting |
|
|
|
5 |
4,123 |
Shell Programming and Scripting |
|
|
|
0 |
1,679 |
Shell Programming and Scripting |
|
|
|
0 |
3,358 |
Programming |
|
|
|
7 |
3,740 |
Shell Programming and Scripting |
|
|
|
2 |
29,390 |
Shell Programming and Scripting |
|
|
|
0 |
2,031 |
Shell Programming and Scripting |
|
|
|
2 |
8,083 |
Shell Programming and Scripting |
|
|
|
1 |
6,240 |
Shell Programming and Scripting |
|
|
|
3 |
8,499 |
UNIX for Advanced & Expert Users |
|
|
|
1 |
2,958 |
Shell Programming and Scripting |
|
|
|
2 |
8,454 |
Shell Programming and Scripting |
|
|
|
6 |
20,922 |
Shell Programming and Scripting |
|
|
|
5 |
10,589 |
Shell Programming and Scripting |
|
|
|
1 |
2,198 |
UNIX for Dummies Questions & Answers |
|
|
|
1 |
4,108 |
Shell Programming and Scripting |
|
|
|
0 |
3,391 |
Shell Programming and Scripting |
|
|
|
0 |
2,393 |
Shell Programming and Scripting |
|
|
|
3 |
8,217 |
Shell Programming and Scripting |
|
|
|
1 |
2,279 |
Shell Programming and Scripting |
|
|
|
5 |
5,392 |
Shell Programming and Scripting |
|
|
|
3 |
16,224 |
UNIX for Dummies Questions & Answers |
Test::Expect(3pm) User Contributed Perl Documentation Test::Expect(3pm)
NAME
Test::Expect - Automated driving and testing of terminal-based programs
SYNOPSIS
# in a t/*.t file:
use Test::Expect;
use Test::More tests => 13;
expect_run(
command => "perl testme.pl",
prompt => 'testme: ',
quit => 'quit',
);
expect("ping", "pong", "expect");
expect_send("ping", "expect_send");
expect_is("* Hi there, to testme", "expect_is");
expect_like(qr/Hi there, to testme/, "expect_like");
DESCRIPTION
Test::Expect is a module for automated driving and testing of terminal-based programs. It is handy for testing interactive programs which
have a prompt, and is based on the same concepts as the Tcl Expect tool. As in Expect::Simple, the Expect object is made available for
tweaking.
Test::Expect is intended for use in a test script.
SUBROUTINES
expect_run
The expect_run subroutine sets up Test::Expect. You must pass in the interactive program to run, what the prompt of the program is, and
which command quits the program:
expect_run(
command => "perl testme.pl",
prompt => 'testme: ',
quit => 'quit',
);
expect
The expect subroutine is the catch all subroutine. You pass in the command, the expected output of the subroutine and an optional comment.
expect("ping", "pong", "expect");
expect_send
The expect_send subroutine sends a command to the program. You pass in the command and an optional comment.
expect_send("ping", "expect_send");
expect_is
The expect_is subroutine tests the output of the program like Test::More's is. It has an optional comment:
expect_is("* Hi there, to testme", "expect_is");
expect_like
The expect_like subroutine tests the output of the program like Test::More's like. It has an optional comment:
expect_like(qr/Hi there, to testme/, "expect_like");
expect_handle
This returns the Expect object.
expect_quit
Closes the Expect handle.
SEE ALSO
Expect, Expect::Simple.
AUTHOR
Leon Brocard, "<acme@astray.com>"
COPYRIGHT
Copyright (C) 2005, Leon Brocard
This module is free software; you can redistribute it or modify it under the same terms as Perl itself.
perl v5.12.3 2011-06-12 Test::Expect(3pm)