Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

How to build a testable interface?

by McMahon (Chaplain)
on Jun 29, 2004 at 15:29 UTC ( #370507=perlquestion: print w/replies, xml ) Need Help??
McMahon has asked for the wisdom of the Perl Monks concerning the following question:

In this node, dragonchild explains how he's going to build a text-based adventure game in several languages, and wonders how to test his code.

pbeckingham recommends testing at the user interface with Expect.

adrianh recommends writing a common api for each implementation and script the testing through the API.

andyf adds a recommendation to write a state-dumping function.

sgifford recommends controlling the testing with a 2-way pipe in and out of the game.

BrowserUK suggests a simple but multidisciplinary approach with a simple script recorder controlled through Test::More.

That is already a lot of interfaces to test a simple command-line program, and we didn't even hear from the Haskell program-by-contract camp (who talk about testable interfaces a lot) or the FIT alternate-UI camp (who are trying to figure out how to do agile user testing).

So:
Is there a best way to build an interface for testing?
Are there contexts in which one test interface is better than another?

Replies are listed 'Best First'.
Re: How to build a testable interface?
by Anonymous Monk on Apr 10, 2017 at 17:23 UTC
    You do not build such an interface. The interface's purpose is not to be tested, it is to provide abstraction to a solution. Unit tests greatest value is not ensuring that the solution is correct, but rather that the solution has coverage such that it can be modified without introducing new bugs. If you have proper coverage, the tests will identify new bugs immediately.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://370507]
help
Chatterbox?
[Corion]: Tabish: What are "tow" packages? Maybe you want to use PAR::Packer to copy them and your main program into one (ugly) script for distribution?

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2017-12-11 09:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (288 votes). Check out past polls.

    Notices?