Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using Expect to Interact with a Curses Based Program

672 views
Skip to first unread message

mt1234

unread,
Feb 16, 2007, 11:07:49 AM2/16/07
to
I have a program containing curses menus that I need to automate the
interaction with (in order to perform some functional testing on the
UI)
1) can Expect interact with curses (specifically ncurses) easily?
2) can you read individual text screens off the terminal without
reading in the whole screen?
3) is it better to use Expect or just TCL to read values from
"fields" and write to specific row/col locations?


Thanks,

MT

Colin Macleod

unread,
Feb 16, 2007, 11:37:05 AM2/16/07
to
On 16 Feb, 16:07, "mt1234" <miketaylor.m...@gmail.com> wrote:
> 1) can Expect interact with curses (specifically ncurses) easily?
> 2) can you read individual text screens off the terminal without

Have a look at tkterm and/or virterm in the demos that come with
Expect, you may be able to base a solution on one of these.

David Gravereaux

unread,
Feb 16, 2007, 12:08:17 PM2/16/07
to
mt1234 wrote:
> I have a program containing curses menus that I need to automate the
> interaction with (in order to perform some functional testing on the
> UI)
> 1) can Expect interact with curses (specifically ncurses) easily?

Yes.

> 2) can you read individual text screens off the terminal without
> reading in the whole screen?

No. A tty is a stream. Expect applies matching on that stream of data so you can
pull from it what you want (and ignore the rest).

> 3) is it better to use Expect or just TCL to read values from
> "fields" and write to specific row/col locations?

Tcl cannot "read" from fields, nor can Expect. Expect already "got" the text on
the way to the terminal. If you specifically know the row and column where the
program will write the "field" of text you're interested in, try catching for
cursor movement command (probably esc[x;yH where x and y are coordinates) in your
[expect] command.

--
Is it a right to remain ignorant?
-- Calvin

signature.asc

Martin Guy

unread,
Mar 8, 2017, 12:30:01 PM3/8/17
to
Hi! I've been doing this successfully in a test harness for a vi editor clone.
You'll find my modified versions of tkterm and virterm in
https://github.com/martinwguy/xvi/tree/master/test

Cheers

M

Rich

unread,
Mar 8, 2017, 12:57:06 PM3/8/17
to
Did you realize you were replying to a *ten year old* posting?

If google groups hid that from you - which I think it does, you should
escape from the awfulness that is google groups and instead get
yourself an ethernal september or aioe account and use a real news
reader.

https://www.eternal-september.org/
http://news.aioe.org/

dave...@gmail.com

unread,
Apr 5, 2018, 7:15:53 PM4/5/18
to

> Did you realize you were replying to a *ten year old* posting?


He probably didn't. But I found his post useful.

0 new messages