Need suggestion on doing character-graphic testing 
Author Message
 Need suggestion on doing character-graphic testing

I am sorry if this is a dup. I think I accidentally post it
in comp.lang.tcl.announce. Apology for that.

Hi,

I am trying to write an Expect script to automate testing of a
character-graphic application. I am trying to use the script
"virterm" in the "example" directory as my guideline. But I
still couldn't get it to work..

I pretty much mimic everthing in virterm. And the problem is here
when I tried to start my application..

#
#  Copied the idea from Adrian's virterm.
#
proc connect {} {

  global term

  # wait for bash shell prompt after spawning a shell early on
  # (... I did tried a simple command expect " #" but I still
  # couldn't start my application later on..)
  term_expect {regexp " #" [$term get 1.0 3.end]}

  # start my application
  exp_send "my_app_name\r"

  # look for some banners or menu items names
  # shown in the app.
  term_expect {regexp "some_banners" [$term get 1.0 10.end]} {
                  exp_send "\r"
        }

  # then..do some checking on the stuff shown on screen
  # after pressing "return"...and so on.

Quote:
}

I found that the script got stuck in term_expect
and kept sitting there.

I tried to look in term_expect but didn't understand much
what it was doing. I tried to print out what was stored
in the $termdata using [$term get 1.0 24.end] after
I started my app. But it was just blank lines.

I also tried starting pico and pine to see if I could see
anything. But there were also blank. No pine or pico
screen ever came up.

I don't think I understand the internals of virterm well.
I am not sure how it handles the output of the application
and how it update the $termdata.

I tried this...

spawn /usr/bin/bash
expect "# " { send "my_app\r" }
after 10000  ; #nothing..just wait to see if anything poped up.
close;wait
puts "got here?"
exit

But I only saw this..

bash-.03# expect virterm.exp
spawn /usr/bin/bash
bash-.03# got here?
bash-.03#

I dont know where the screen of my app went after my spawning
of bash.

Thanks for any advice/suggestions,

-opasvt



Fri, 02 Feb 2007 17:06:33 GMT  
 Need suggestion on doing character-graphic testing

Quote:

> I am sorry if this is a dup. I think I accidentally post it
> in comp.lang.tcl.announce. Apology for that.

> Hi,

> I am trying to write an Expect script to automate testing of a
> character-graphic application. I am trying to use the script
> "virterm" in the "example" directory as my guideline. But I
> still couldn't get it to work..

> I pretty much mimic everthing in virterm. And the problem is here
> when I tried to start my application..

> #
> #  Copied the idea from Adrian's virterm.
> #
> proc connect {} {

>   global term

>   # wait for bash shell prompt after spawning a shell early on
>   # (... I did tried a simple command expect " #" but I still
>   # couldn't start my application later on..)
>   term_expect {regexp " #" [$term get 1.0 3.end]}

>   # start my application
>   exp_send "my_app_name\r"

>   # look for some banners or menu items names
>   # shown in the app.
>   term_expect {regexp "some_banners" [$term get 1.0 10.end]} {
>                   exp_send "\r"
>         }

>   # then..do some checking on the stuff shown on screen
>   # after pressing "return"...and so on.
> }

> I found that the script got stuck in term_expect
> and kept sitting there.

> I tried to look in term_expect but didn't understand much
> what it was doing. I tried to print out what was stored
> in the $termdata using [$term get 1.0 24.end] after
> I started my app. But it was just blank lines.

> I also tried starting pico and pine to see if I could see
> anything. But there were also blank. No pine or pico
> screen ever came up.

> I don't think I understand the internals of virterm well.
> I am not sure how it handles the output of the application
> and how it update the $termdata.

> I tried this...

> spawn /usr/bin/bash
> expect "# " { send "my_app\r" }
> after 10000  ; #nothing..just wait to see if anything poped up.
> close;wait
> puts "got here?"
> exit

> But I only saw this..

> bash-.03# expect virterm.exp
> spawn /usr/bin/bash
> bash-.03# got here?
> bash-.03#

> I dont know where the screen of my app went after my spawning
> of bash.

> Thanks for any advice/suggestions,

> -opasvt

Does your application require a utmp entry?
if so check this FAQ http://expect.nist.gov/FAQ.html#q56

I wrote a large test harness for a character-graphic application
(15,000+ lines of Tcl), I never used virterm but it may be overkill.
The control character output from character-graphic applications is
easy enough to ignore when expecting strings.
Try just expecting the output you are looking for and see what
happens.

Anthony



Sat, 03 Feb 2007 01:37:50 GMT  
 Need suggestion on doing character-graphic testing

Quote:

>I am sorry if this is a dup. I think I accidentally post it
>in comp.lang.tcl.announce. Apology for that.

>Hi,

>I am trying to write an Expect script to automate testing of a
>character-graphic application. I am trying to use the script
>"virterm" in the "example" directory as my guideline. But I
>still couldn't get it to work..

>I pretty much mimic everthing in virterm. And the problem is here
>when I tried to start my application..

>#
>#  Copied the idea from Adrian's virterm.
>#
>proc connect {} {

>  global term

>  # wait for bash shell prompt after spawning a shell early on
>  # (... I did tried a simple command expect " #" but I still
>  # couldn't start my application later on..)
>  term_expect {regexp " #" [$term get 1.0 3.end]}

>  # start my application
>  exp_send "my_app_name\r"

>  # look for some banners or menu items names
>  # shown in the app.
>  term_expect {regexp "some_banners" [$term get 1.0 10.end]} {
>                  exp_send "\r"
>        }

>  # then..do some checking on the stuff shown on screen
>  # after pressing "return"...and so on.
>}

>I found that the script got stuck in term_expect
>and kept sitting there.

>I tried to look in term_expect but didn't understand much
>what it was doing. I tried to print out what was stored
>in the $termdata using [$term get 1.0 24.end] after
>I started my app. But it was just blank lines.

>I also tried starting pico and pine to see if I could see
>anything. But there were also blank. No pine or pico
>screen ever came up.

>I don't think I understand the internals of virterm well.
>I am not sure how it handles the output of the application
>and how it update the $termdata.

>I tried this...

>spawn /usr/bin/bash
>expect "# " { send "my_app\r" }
>after 10000  ; #nothing..just wait to see if anything poped up.
>close;wait
>puts "got here?"
>exit

>But I only saw this..

>bash-.03# expect virterm.exp
>spawn /usr/bin/bash
>bash-.03# got here?
>bash-.03#

>I dont know where the screen of my app went after my spawning
>of bash.

>Thanks for any advice/suggestions,

>-opasvt

I don't understand the question.

I suspect, thought, that autoexpect <URL: http://wiki.tcl.tk/autoexpect >
is likely to help.



Sat, 03 Feb 2007 02:08:10 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Need automation test tools suggestions

2. Need suggestion: testing for methods & vars (Clipper5)

3. Converting INTEGER to CHARACTER - can it be done?

4. ARexx: doing simple interactive graphics?

5. Doing graphics + hardware I/O + misc

6. Converting INTEGER to CHARACTER - can it be done?

7. Converting INTEGER to CHARACTER - can it be done?

8. Graphics programming book suggestions?

9. Non-ASCII characters, suggestion and question

10. tab every nth character suggestion

11. Testing, I know I keep doing it but I'm tesating :-)

12. errors when doing 'make test'

 

 
Powered by phpBB® Forum Software