From: Phil Muldoon <pmuldoon@redhat.com>
To: Andrew Cagney <cagney@redhat.com>
Cc: frysk <frysk@sourceware.org>
Subject: Re: frysk.expunit, Expect like functionality within JUnit
Date: Fri, 02 Feb 2007 20:52:00 -0000 [thread overview]
Message-ID: <45C3A489.9060805@redhat.com> (raw)
In-Reply-To: <45C0E033.2060808@redhat.com>
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
next prev parent reply other threads:[~2007-02-02 20:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-31 18:30 Andrew Cagney
2007-02-02 20:52 ` Phil Muldoon [this message]
2007-02-02 21:10 ` Andrew Cagney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=45C3A489.9060805@redhat.com \
--to=pmuldoon@redhat.com \
--cc=cagney@redhat.com \
--cc=frysk@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).