Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the WWW-Mechanize CPAN distribution.

Report information
The Basics
Id: 16965
Status: resolved
Priority: 0/
Queue: WWW-Mechanize

People
Owner: Nobody in particular
Requestors: ALester [...] flr.follett.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



To: bug-www-mechanize [...] rt.cpan.org
Subject: Fw: new: TW::Mechanize::stuff_fields()
From: ALester [...] flr.follett.com
Date: Sun, 8 Jan 2006 12:51:42 -0600
Mike O'Regan/flr wrote on 03/30/2005 05:05:42 PM: Show quoted text
> All, > > There's a new tool in TW::Mechanize to help find places where the > app allows the user to enter more data than will fit in the > corresponding database column: stuff_fields(). It maxes out all > the fields in the current form so that you don't have to hard-code > long strings into tests. Try it out when you are next > modifying/writing a test that fills in a form. The interface: > > =head2 $agent->stuff_inputs( [\%options] ) > > Finds all free-text input fields (text, textarea, and password) in the > current form and fills them to their maximum length in hopes of finding > application code that can't handle it. Fields with no maximum length > and all textarea fields are set to 66000 bytes, which will often be > enough to overflow the data's eventual recepticle. > > There is no return value. > > If there is no current form then nothing is done. > > The hashref $options can contain the following keys: > > ignore: hash value is hashref of field names to not touch, e.g.: > > $mechanize_object->stuff_inputs( { > ignore => { 'specialfield1'=>1, 'specialfield2'=>1 } > } ); > > fill: hash value is default string to use when stuffing fields. Copies > of the string are repeated up to the max length of each field. E.g.: > > $mechanize_object->stuff_inputs( { > fill => '@' # stuff all fields with something easy to recognize > } ); > > specs: hash value is arrayref of hashrefs with which you can pass
detailed Show quoted text
> instructions about how to stuff a given field. E.g.: > > $mechanize_object->stuff_inputs( { > specs=>{ > # some fields are datatype-constrained. It's most common to > # want the field stuffed with valid data. > 'widget_quantity' => { fill=>'9' }, > 'notes' => { maxlength=>2000 }, > } > } ); > > The specs allowed are 'fill' (use this fill for the field rather > than the default) > and 'maxlength' (use this as the field's maxlength instead of any
maxlength Show quoted text
> specified in the HTML). > > =cut > > Mike O'Regan
stuff_fields() is in T:W:Mech and the grep_(inputs|fields) is in Mech proper.