Re: Tests needing user parameters
On Thu, 20 Oct 2005, A. Pagaltzis wrote: > * David Landgren <[EMAIL PROTECTED]> [2005-10-20 10:30]: > > Jess Robinson wrote: > > >Right, I'd seen a few modules do this, but.. Is there a > > >*standard* way of doing it? Those Makefile.PLs tend to look > > >cluttered and confusing IMO.. a nice: > > > > > >use Test::Auth; > > >get_user_fields("user", "password"); > > > > > >would be preferable.. (hmmm, could write something that does > > >that, using IO::Prompt.. anyone interested?) > > > > If there's a standard way of doing it, it would be really nice > > that it understood when it was being run in a smoke > > environment, and asked no questions and used built-in defaults. > > That's exactly what EU::MM's prompt() function and > Module::Build's prompt() method do/are for. > Thanks, that sounds like what I was looking for! (hmm, assuming I can pass the results on to make test.. I'll have a look) Jess
Re: Tests needing user parameters
On Wed, 19 Oct 2005, Spencer Ogden wrote: > Requiring user input for testing is probably not a good idea. All of the > sudden you now have to validate the input data as well before you can test > your own code. Then you need to test you validation code, etc. > > This article may suggest a solution: > http://www.perl.com/pub/a/2005/04/07/mockobject_kata.html > > Just fake it. > Thanks for the suggestion, but consider also: The whole mock object thing would also need a thorough testing itself, making it even more complex. Also, supposing the site that I am connecting to changed their responses, I'd never know, since I'm only testing against a mock-up of it. I'd agree if the thing I was connecting to was under my control, but it isn't. Jess
Re: Tests needing user parameters
On Wed, 19 Oct 2005, Ken Williams wrote: > > On Oct 19, 2005, at 4:50 PM, Jess Robinson wrote: > > > My module will login to a web service and manipulate data > > programmatically.. Nothing critical I assure you, just a tool ;) Since > > theres no dummy/test account that I know of, I'll need the users > > account/email address and password to login. > > Typically you'd add some code to the Makefile.PL or Build.PL that asks the > user for a username/password to use for testing, and gives the user an option > to skip those tests. DBI modules often do this, for example (where the > username/password is for a database to access). > > If you're using ExtUtils::MakeMaker, you'll have to find some file to stash > the information, probably somewhere in t/ . If you're using Module::Build, > have a look at the notes() method, which is for caching this kind of > information. Right, I'd seen a few modules do this, but.. Is there a *standard* way of doing it? Those Makefile.PLs tend to look cluttered and confusing IMO.. a nice: use Test::Auth; get_user_fields("user", "password"); would be preferable.. (hmmm, could write something that does that, using IO::Prompt.. anyone interested?) Jess
Re: Tests needing user parameters
On Wed, 19 Oct 2005, Tim Maher wrote: > On Wed, Oct 19, 2005 at 09:51:12PM +0100, Jess Robinson wrote: > > > > Hey folks, > > > > I'm writing a module which will need user account data for it's tests, and > > I'm wondering if there's a standard way (or module) for doing this.. > > What do you mean by "user account data"? > > Perhaps UNIX/Linux UIDs and GIDs? Oops, sorry, thought it made sense ;) My module will login to a web service and manipulate data programmatically.. Nothing critical I assure you, just a tool ;) Since theres no dummy/test account that I know of, I'll need the users account/email address and password to login. Jess
Tests needing user parameters
Hey folks, I'm writing a module which will need user account data for it's tests, and I'm wondering if theres a standard way (or module) for doing this.. Else I'll guess I'll look for environment variables and otherwise not test, any ideas? Jess