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: [agile-testing] Unit Testing the Presentation Layer   Message List  
Reply | Forward Message #1048 of 1051 |
Re: [agile-testing] Unit Testing the Presentation Layer

John Overbaugh wrote:

> Presentation layer: we have a lot of cookie, session, view state and
> Ajax code in our presentation level. Apparently this is rather brittle
> code which means we've frequently broken stuff in the past. My dev and I
> have been discussing this, and the impact of a cookie or session change
> has been far-reaching and surprising. So we're wondering if there's a
> way to cover this stuff in a unit test - after all, this is code written
> by developer, it ought to be unit tested but that's the challenge we're
> grappling with. The challenge, of course, is that we're talking about
> unit tests which require interaction with a web server.

Here's a metaphor - the Golden Spike at Promontory Point, Utah, where the Union
Pacific and Central Pacific railways met for our first intercontinental
railroad.

A test through the browser is like driving a train all the way from St Louis to
San Fransisco.

Two unit tests are like driving all the way from one city to the golden spike.

To unit test, you don't need to test that a variable went into a session, went
into a cookie, came out in an action, went into JavaScript, went into Ajax, and
went into the browser.

You need to unit test each of those steps - even sinking as low as using
assert_match to spot-check that a variable showed up in some string.

Yet each unit test must reach just a little into the next layer. Otherwise, your
tests might not detect if you have two railroads that don't meet at Promontory
Point...

--
Phlip



Tue Jun 16, 2009 7:04 pm

phlipcpp
Offline Offline
Send Email Send Email

Forward
Message #1048 of 1051 |
Expand Messages Author Sort by Date

... Will ASP allow you to cook a web page without sending it over the wire? If you Mock The Server, you can then test - even TDD - by writing assertions that...
Phlip
phlipcpp
Offline Send Email
Jun 12, 2009
2:24 am

... Unit testing the presentation layer should treat the test targets the same as any other layer would test them. In web programming, a web page is a big...
Phlip
phlipcpp
Offline Send Email
Jun 12, 2009
3:48 am

Re: Can ASP render a page back as a string. Absolutely! Its call Response.Write, just pipe it out to whatever channel you like :) Regards, Miguel de Sousa ...
miguel de sousa
migdesousa
Offline Send Email
Jun 12, 2009
4:45 am

... Could anyone here who's familiar with both ASP's Response.Write, and with Rails's ActionController::TestCase's get() method, write a little pseudocode here...
Phlip
phlipcpp
Offline Send Email
Jun 12, 2009
4:49 am

... To add a new feature, you should generally add it at the business layer first. The goal will be that anything a user can do to the View, a unit test can...
Phlip
phlipcpp
Offline Send Email
Jun 12, 2009
2:25 pm

... Here's a metaphor - the Golden Spike at Promontory Point, Utah, where the Union Pacific and Central Pacific railways met for our first intercontinental...
Phlip
phlipcpp
Offline Send Email
Jun 16, 2009
7:05 pm
Advanced

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