Unix and Linux Discussions Tagged with expect |
|
Thread / Thread Starter |
Last Post |
Replies |
Views |
Forum |
|
|
|
1 |
1,616 |
Shell Programming and Scripting |
|
|
|
7 |
8,666 |
Shell Programming and Scripting |
|
|
|
5 |
10,010 |
UNIX for Advanced & Expert Users |
|
|
|
0 |
3,399 |
UNIX for Dummies Questions & Answers |
|
|
|
0 |
3,019 |
UNIX and Linux RSS News |
|
|
|
0 |
773 |
Software Releases - RSS News |
|
|
|
8 |
16,917 |
Solaris |
|
|
|
0 |
4,767 |
Shell Programming and Scripting |
|
|
|
1 |
4,791 |
AIX |
|
|
|
0 |
4,478 |
Shell Programming and Scripting |
|
|
|
8 |
8,834 |
Shell Programming and Scripting |
|
|
|
0 |
694 |
Software Releases - RSS News |
|
|
|
4 |
11,064 |
UNIX for Advanced & Expert Users |
|
|
|
0 |
2,196 |
Shell Programming and Scripting |
|
|
|
1 |
14,695 |
Shell Programming and Scripting |
|
|
|
6 |
14,549 |
Shell Programming and Scripting |
|
|
|
4 |
13,685 |
Shell Programming and Scripting |
|
|
|
2 |
16,253 |
Shell Programming and Scripting |
|
|
|
2 |
13,197 |
UNIX for Dummies Questions & Answers |
|
|
|
5 |
13,753 |
Shell Programming and Scripting |
|
|
|
8 |
26,674 |
Shell Programming and Scripting |
|
|
|
5 |
28,164 |
Programming |
|
|
|
5 |
3,673 |
Shell Programming and Scripting |
|
|
|
3 |
22,036 |
Shell Programming and Scripting |
|
|
|
8 |
14,459 |
Shell Programming and Scripting |
|
|
|
2 |
16,262 |
HP-UX |
|
|
|
1 |
3,549 |
UNIX for Dummies Questions & Answers |
|
|
|
2 |
7,051 |
UNIX for Dummies Questions & Answers |
|
|
|
2 |
5,363 |
UNIX for Dummies Questions & Answers |
|
|
|
2 |
28,683 |
Programming |
|
|
|
2 |
3,118 |
Programming |
|
|
|
9 |
11,728 |
UNIX for Dummies Questions & Answers |
|
|
|
2 |
2,914 |
Cybersecurity |
|
|
|
2 |
2,773 |
Programming |
|
|
|
1 |
9,256 |
UNIX for Dummies Questions & Answers |
|
|
|
1 |
2,947 |
UNIX for Dummies Questions & Answers |
|
|
|
4 |
18,400 |
Programming |
|
|
|
6 |
9,334 |
UNIX for Dummies Questions & Answers |
|
|
|
2 |
2,922 |
UNIX for Dummies Questions & Answers |
|
|
|
2 |
2,460 |
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)