24 February 2012

Making Tests Modular

In a recent code review, the VP of technology gave me some good advice.  He looked at a test I had, and in the test, I was validating all the elements on the page in question.

He suggested I stop doing that, and instead focus a test's assertions just on a module basis.  So if a page has 4 modules (Basic Info, Photo, Next Steps, SiteNav), to not make assertions for all items - but instead have a test that only checks assertions on Basic Info, then another test with assertions just for Photos, then another test with assertions for Next Steps and so forth.  So each test, just focuses on a specific module. 

The idea here is to remove the complexity and thus brittleness of the tests themselves.

No comments:

Post a Comment