[TIP] Writing Separate Functional Tests

Laura Creighton lac at openend.se
Wed Nov 21 07:51:20 PST 2007


In a message of Wed, 21 Nov 2007 10:18:17 EST, "Noah Gift" writes:
>--===============1433746764==
>Content-Type: multipart/alternative; 
>	boundary="----=_Part_2709_6144239.1195658297185"
>
>------=_Part_2709_6144239.1195658297185
>Content-Type: text/plain; charset=ISO-8859-1
>Content-Transfer-Encoding: 7bit
>Content-Disposition: inline
>
>On Nov 21, 2007 10:14 AM, David Malcolm <dmalcolm at redhat.com> wrote:
>
>> On Wed, 2007-11-21 at 09:35 -0500, Noah Gift wrote:
>> > I have a gigantic threaded beast I need to test, and I want to write
>> > functional tests that supplement the doctests and unittests, but
>> > wanted some advice on the proper way to do this.  I have not seen muc
>h
>> > documentation on writing non-web functional tests, my tool is a CLI
>> > tool. The basic thing I want to verify is that my tool creates a XML
>> > file with the information I would expect to be there.  For example, i
>s
>> > there a selenium equivalent for command line tools?
>> >
>> Have you tried the "expect" tool; see e.g.
>> http://pexpect.sourceforge.net/
>>
>> Doesn't do recording AFAIK, but useful for invoking CLI tools in a
>> testing context
>>
>
>Dave,
>
>I hadn't even thought of that, using pexpect is an interesting idea thoug
>h.
> Recording command line tools seems like it could be a really cool open
>source testing project actually, now that I think about it more....  Mayb
>e a
>Sprint for PyCon?
>
>
>>
>>
>> Hope this helps
>> Dave Malcolm
>>

Expect has a granularity in seconds.  If you need to measure that
something happens sooner than that, then expect is not for you.

Been there, done that, got supremely frustrated.

If you happen to need to be testing CISCO routers, I may have a
pile of old C code that can help.

Laura



More information about the testing-in-python mailing list