Search the web
Sign In
New User? Sign Up
TestFirstUserInterfaces
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want to share photos of your group with the world? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Re: [XP] help for learn of XP   Message List  
Reply | Forward Message #977 of 1052 |
Ian Collins wrote:

>>"Ruby on Rails" was invented using most of the XP practices. For example,
>>it
>>is unique among web development platforms for letting you easily write
>>unit
>>tests for every aspect of a web application.

> How does it differ form using something like PHPUint and JSUnit?

To answer the OP, those are *Units. Rails is a complete application; an
example of a project.

The difference with *Units in general is Rails's test framework has
assertions and systems that match each layer of Rails's web framework.
Here's a trivial example of submitting a form:

login_as :ian
get :index

submit_form('edit_user') do |form|
assert_equal '4111111111111118', form['user[cc]'].value
assert_equal '', form['user[charge]'].value
form['user[widget]'] = 'widget_3'
end

assert_equal 1, @tygr.widgets.count

The first line comes from custom test-side code that logs us into the
authentication system.

The second line gets the 'index.rhtml' file and processes it as if a web
browser had sent it. This follows the "Mock the Server" pattern.

index.rhtml has a form that calls the edit_user server action. So the
submit_form line is an assertion that finds the form, and then simulates
sending its data

The do-end block can assert the form's variables, and can change them. If
the form doesn't have a given 'user[field]' input item, by name, the
assertion will fail. This prevents the degenerate situation where the tests
send info to the back end that the user interface does not send. The same
assertion tests the GUI and back-end at the same time.

--
Phlip
http://www.greencheese.us/ZeekLand <-- NOT a blog!!!




Sat Mar 10, 2007 9:04 pm

phlipcpp
Offline Offline
Send Email Send Email

Forward
Message #977 of 1052 |
Expand Messages Author Sort by Date

... To answer the OP, those are *Units. Rails is a complete application; an example of a project. The difference with *Units in general is Rails's test...
Phlip
phlipcpp
Offline Send Email
Mar 10, 2007
9:07 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help