Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Testing Interactive Interface?

by moritz (Cardinal)
on Oct 18, 2013 at 08:57 UTC ( #1058731=note: print w/ replies, xml ) Need Help??


in reply to Testing Interactive Interface?

There are several approaches:

  • Make the interactive parts optional, for example accept command line arguments, and only ask interactively if command lines are missing. Simplifies testing and automation a lot.
  • Make the code an object on which it calls the ->readline method, and only create a Term::ReadLine object in its place if no such object was passed. That makes it easy to supply a "fake" Term::ReadLine object of your own creatin in the test code (that's called "dependency injection").
  • Automate the whole thing across a process boundary with Expect-like modules.

I'd certainly go with the first option if possible, and fall back to the second option if ithe first isn't applicable.


Comment on Re: Testing Interactive Interface?
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1058731]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2014-07-26 12:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (176 votes), past polls