asp.net mvc - Why should I test my HTMLHelpers? -
is there tangible value in unit testing own htmlhelpers? many of these things spit out bunch of html markup - there's little if no logic. so, compare 1 big html string another? mean, of these thing require @ generated markup in browser verify it's output want.
seems little pointless.
yes.
while there may little no logic now, doesn't mean there isn't going more logic added down road. when logic added, want sure doesn't break existing functionality.
that's 1 of reasons unit tests written.
if you're following test driven development, write test first , write code satisfy test.
that's reason.
you want make sure identify , test possible edge cases helper (like un-escaped html literals, un-encoded special characters, etc).
Comments
Post a Comment