[rspec-users] Presentation Testing and CSS ids

Andrew Premdas apremdas at gmail.com
Wed Mar 11 17:02:29 EDT 2009


The key phrase is semantic meaning. Its good to use CSS to give semantic
meaning to things that appear on web pages. Not only can these id's or
classes be useful for using with screen readers, they should be stable
things that don't change even if the design of the page does. It should be
easy to say to designers don't change these tags - they can either add extra
classes or change the style definition.

However if you label things with poor semantic meaning then don't be
suprised when they change. Testing for a mediumBlueBox is asking for a
kicking!

Finally finding good semantic descriptions is not easy. I think
"submitCustomerDetails" is better than "submitForm", "submitButton" or even
"submitCustomerDetailsButton". But I have no idea whether anyone else would
agree with me :).

2009/3/9 James Byrne <lists at ruby-forum.com>

> Zach Dennis wrote:
>
> > In my experience relying on the syntactic details of the page is
> > extremely brittle and cumbersome. ... Some tags have both syntactic
> > and semantic meaning, such as forms, labels, fieldsets, and anchor tags.
> >
>
> Is it "brittle" to test for specific css selectors that are tied to page
> details?  A typical case is where one has a button to drive in webrat
> and instead of using the button text we use the associated id value
> instead.
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090311/504dc759/attachment-0001.html>


More information about the rspec-users mailing list