Randy Syring wrote:
> I would like to be able to test my web applications from the
> perspective of an actual user.  Are there any tools that would let me
> do something like:
> 
> c = Client(myapp)

app = TestApp(myapp)

> r = c.get(/user/login)

r = app.get('/user/login')

> r.checkfor('User Login')

r.mustcontain('User Login')

> r.checkfor('enter credentials')

r.mustcontain('enter credentials')

> r.set('username', 'foo')

r.form['username'] = 'foo'

> r.set('password', 'bar')

r.form['password'] = 'bar'

> r2 = c.submit(r)

r2 = r.form.submit()


And... I don't feel like translating the rest, but it's all just 
different names for the stuff in WebTest, which is what Pylons sets up 
for its tests by default.

> r2.checkfor('login succesful')
> r = c.get(/uploadfile) # at this point, the user's session from the
> above login would be in effect
> r = c.setfile('toupload', open('myfile.txt'))
> r2 = c.submit(r)
> r2.checkfor('file uploaded')
> etc.
> 
> Obviously, the API would vary, but I hope you get my drift.


-- 
Ian Bicking : [EMAIL PROTECTED] : http://blog.ianbicking.org

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to