是否有测试按钮等Web控件输出的最佳方法? [英] Is there a best way to test the web control output for eg button?

查看:82
本文介绍了是否有测试按钮等Web控件输出的最佳方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我们有一些需要编写测试用例的webcontrols,我们将呈现html编写为控件实现的一部分.到目前为止,控件将html作为输出,因此对于现有控件,他们在测试用例中将html作为字符串变量,并通过调用render方法使用此变量来检查控件输出.像下面这样.

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());


即使html输出发生任何变化,测试用例也不起作用.有没有更好的方法来测试控件的输出

谢谢,
Ramu.S


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

推荐答案

HTML是带有文档模型的标记语言.
您是否尝试过将输出读取为Xml文档并对其进行测试(Xml节点),而不是读取字符串?
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?


这篇关于是否有测试按钮等Web控件输出的最佳方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆