Click here to Skip to main content
15,914,642 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
Hi,

We have webcontrols for which we need to write test cases, We write the rendering html as part of the control implementation. As of now, control spits html as output, so for the existing controls, they took the output html as string variable in the test case, and uses this variable to check the control ouput, by calling the render method. something like below.

strOutputHtml = ""

Assert.Equal(strOuputHtml, control.reder());

even if there is any change in the html output, then the test cases will not work. Is there a better way of testing the output of the control

Thanks,
Ramu.S
Posted
Updated 17-Feb-11 14:10pm
v3
Comments
Abdul Quader Mamun 17-Feb-11 20:03pm    
Spelling check.

1 solution

HTML is a mark up language with a document model.
Have you tried reading the output as, say an Xml document and test against that (the Xml nodes) instead of reading a string?
 
Share this answer
 
Comments
Ramu Sangabathula Original 17-Feb-11 21:32pm    
I think this is a good idea, but when the control output is changed frequently, I am looking how much impact the code will cause if we go with XML DOM model.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900