* frysk.expunit, Expect like functionality within JUnit
@ 2007-01-31 18:30 Andrew Cagney
2007-02-02 20:52 ` Phil Muldoon
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cagney @ 2007-01-31 18:30 UTC (permalink / raw)
To: frysk
Hello,
The Expect program lets the user interact with a console based program,
sending it input and checking its output. The existing testing
framework dejagnu builds on expect.
The package frysk.expunit provides functionality similar to Expect, but
in a way that integrates into the JUnit framework. By doing this,
developers:
-> need only learn JUnit, and this extension, and not an entirely new
language (tcl/tk) and test framework (dejagnu)
-> are able to implement tests in a similar consistent manner, in
particular, first problem indicates failure - frameworks such as dejagnu
have a very different testing model, allowing a failing test to bumble
on regardless
With this in place I'll look at a few of the existing dejagnu tests, see
how well they translate, and how workable the existing interfaces are.
See
http://sourceware.org/frysk/javadoc/public/frysk/expunit/package-summary.html
for a simple example. Critic, expecially of the workability of the
interfaces, most welcome.
Andrew
PS: This proved to be a good way of expanding the testing of
frysk.sys.PseudoTerminal
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: frysk.expunit, Expect like functionality within JUnit
2007-01-31 18:30 frysk.expunit, Expect like functionality within JUnit Andrew Cagney
@ 2007-02-02 20:52 ` Phil Muldoon
2007-02-02 21:10 ` Andrew Cagney
0 siblings, 1 reply; 3+ messages in thread
From: Phil Muldoon @ 2007-02-02 20:52 UTC (permalink / raw)
To: Andrew Cagney; +Cc: frysk
Andrew Cagney wrote:
> Hello,
>
> The Expect program lets the user interact with a console based
> program, sending it input and checking its output. The existing
> testing framework dejagnu builds on expect.
>
> The package frysk.expunit provides functionality similar to Expect,
> but in a way that integrates into the JUnit framework. By doing this,
> developers:
>
> -> need only learn JUnit, and this extension, and not an entirely new
> language (tcl/tk) and test framework (dejagnu)
The current expect tests use tcl, so having the expect-like tests in
Java will be a welcome addition. For fcore, the tests are: create an
expected fail condition, check that it fails like it should. Here is an
existing test:
#start test program, and store pid.
set funit_path [findfile "$pwd/frysk/pkglibdir/funit-child"
"$pwd/frysk/pkglibdir/funit-child" funit-child]
set funit_pid [spawn ${funit_path} 100 0 0]
set funit_sid $spawn_id
#start tester program with valid pid, but wrong -console argument
spawn $fcore_path -console frysk=BADLOG $funit_pid
#test output.
expect {
-re "fcore: Invalid log console: BADLOG"
{pass test_fcore_bad_console_log_argument}
default {fail test_fcore_bad_console_log_argument}
}
So for the purposes of the above test, the new Java Expect should
simplfy things nicely. Given the above, would the correct java code be
something like:
{start up an example java process, using DetachedAckProcess or
AckDaemonProcess}
e = new Expect (new String[] { "fcore", "-console","frysk=BADLOG",myPid});
e.assertExpect ("fcore: Invalid log console: BADLOG");
I'm not sure how you would find the fcore in the above (in-tree and
out-of-tree testing), but if the test converts to as simply as above,
that is great!
Regards
Phil
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: frysk.expunit, Expect like functionality within JUnit
2007-02-02 20:52 ` Phil Muldoon
@ 2007-02-02 21:10 ` Andrew Cagney
0 siblings, 0 replies; 3+ messages in thread
From: Andrew Cagney @ 2007-02-02 21:10 UTC (permalink / raw)
To: Phil Muldoon; +Cc: frysk
Phil Muldoon wrote:
>
>
> So for the purposes of the above test, the new Java Expect should
> simplfy things nicely. Given the above, would the correct java code be
> something like:
>
> {start up an example java process, using DetachedAckProcess or
> AckDaemonProcess}
>
> e = new Expect (new String[] { "fcore",
> "-console","frysk=BADLOG",myPid});
> e.assertExpect ("fcore: Invalid log console: BADLOG");
>
Yes, that is it. And yes, right now there isn't a path to find fcore.
I'll see about adding it.
I'm also thinking of contracting assertExpect() to just expect()
Andrew
> I'm not sure how you would find the fcore in the above (in-tree and
> out-of-tree testing), but if the test converts to as simply as above,
> that is great!
>
> Regards
>
> Phil
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-02-02 21:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-31 18:30 frysk.expunit, Expect like functionality within JUnit Andrew Cagney
2007-02-02 20:52 ` Phil Muldoon
2007-02-02 21:10 ` Andrew Cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).