Thanks Cliff, but that is overkill for me. I already have the test data. I 
just need to pre-populate the web2py form with it.

On Monday, August 20, 2012 2:23:30 PM UTC+2, Cliff Kachinske wrote:
>
> Have you looked into Selenium at www.seleniumhq.org?
>
> With it you can simulate user input and check the system response.
>
> On Monday, August 20, 2012 5:30:19 AM UTC-4, Daniel Gonzalez wrote:
>>
>> Hi,
>>
>> I am trying to pre-populate the profile form with some random data, which 
>> I am using for testing, like this:
>>
>> def random_pre_populate(form):
>>     register_data  = RegisterData().random()
>>     form.vars.first_name = register_data['first_name']
>>     form.vars.surname1   = register_data['surname1']
>>     form.vars.surname2   = register_data['surname2']
>>     form.vars.email      = register_data['email']
>>     form.vars.address    = register_data['address']
>>     form.vars.postcode   = register_data['postcode']
>>     form.vars.city       = register_data['city']
>>     form.vars.country    = register_data['country']
>>     return form
>>
>> def index():
>>     response.flash = T("Welcome to Acme!")
>>     response.my_header = False
>>     login_form    = FORM(INPUT(_name='email', _style = 
>> 'width:360px;height:28px;margin-bottom:0px;', requires=IS_EMAIL(
>> error_message=auth.messages.invalid_email), _placeholder = T('Email')),
>>                          INPUT(_type = 'submit', _value = T('Sign 
>> In'),_class 
>> = 'btn btn-large'),
>>                          _action = URL(r = request, f = agent_redirect))
>>     register_form = FORM(INPUT(_name='email', _style = 
>> 'width:360px;height:28px;margin-bottom:0px;', requires=IS_EMAIL(
>> error_message=auth.messages.invalid_email), _placeholder = T('Email')),
>>                          INPUT(_type = 'submit', _value = T('Try 
>> Out'),_class 
>> = 'btn btn-large btn-primary'),
>>                          _action = URL(r = request, f = 'user/register'))
>>     # Pre-populate the register_form - this is useful for testing, to 
>> avoid having to type this data
>>     register_form = random_pre_populate(register_form)
>>
>>     return dict(message       = T('Hello world!'),
>>                 login_form    = login_form,
>>                 register_form = register_form)
>>
>> The data generation is done in RegisterData().random(), which just uses 
>> mostly-random data.
>> Unfortunately the data does not appear in the profile form. How can I 
>> achieve this?
>>
>> Thanks,
>> Daniel
>>
>

-- 



Reply via email to