02 March 2012

Assertions shouldn't be made at markup level

It's often tempting to make assertions at the markup level.  But in practice the assertions at the markup level, like:
td.header.text().equals("Test") are very fragile.  If the page layout changes the test will break.

This might be a good practice if the testing expectation is to break anytime layout changes.  But in general, for my use of the tests, it makes more sense to not break on layout changes, but to verify the content loading.

In those cases, we are working with Front End Developers to insure that page layout changes keep to a standard.  Like having a Div ID or Class that could be referenced. 

No comments:

Post a Comment