RE: Re: Re: Two Tier, call_ str_ fix

"Michael Geary" <[email protected]> Wed, 14 Jul 2004 14:56:41 -0700
Newsgroups gmane.comp.lang.prothon.user
Message-ID <[email protected]>
> From: Mark Hahn
> I downloaded TestComplete.  I don't know if I can handle 
> learning another scripting language in the midlle of dealing 
> with Prothon.  It also seems like overkill not to mention it 
> costs money.
> 
> I think it would be worth my while to figure out how to add a 
> library to Prothon to drive a console as a unit-under-test 
> and do it from Prothon. It would be a better use of my time 
> to add something to Prothon instead of learning another tool.

That makes good sense.

> Anyone have any clue how to drive a console as a 
> unit-under-test?  How do I replace a win32 process's 
> stdin/stdout without the prcoess code knowing about it?
> 
> I guess I could replace it from the inside of the console 
> code but that wouldn't be a true test.

Basically, you create a pipe for each handle (don't forget stderr) and pass
it to the child process in the STARTUPINFO structure in a CreateProcess
call.

This Google search will find you several examples:

createprocess redirect stdin stdout

The msdn.microsoft.com sample near the list is the one I'd use.

-Mike