编码 UI 测试动态控件
我记录了几个编码的 ui 测试,以逐步完成我们的 ASP.NET Web 应用程序中的各种数据收集步骤。然而,我们有自定义代码,当用户逐步通过“向导”(仅使用向导作为通用术语)时,可以动态呈现 html。所以从浏览器的角度来看,用户将始终在同一个页面上,例如Wizard.aspx,但是当页面回发时,会呈现不同的html,具有不同的控件,
因此,当编码测试运行时,它有时会失败,因为回发后,要渲染的html渲染得不够快,并且搜索找不到控件,这种情况也会发生在点击上,即播放试图点击一个控件,即可能尚未呈现的按钮,我已经通过在步骤之间手动添加 ThinkTime 纠正了这个问题,但感觉就像是黑客攻击。由于编码的 ui 测试正在进行中,有没有办法告诉 Playback 等待控件渲染,我已经看到了 WaitForControlExist 方法,但我不太清楚在哪里使用它。
I have recorded a couple of coded ui tests to step through various data collection steps in our asp.net web application. However, we have custom code that renders html on the fly as a user steps through the "wizard" (just using wizard as generalized term). So from a browser perspective, the user will always be on the same page, for example, Wizard.aspx, but when the page is posted back, different html is rendered, with different controls
As a result, when the coded test is running, it sometimes fails because after the post back, the html that is to be rendered hasn't been rendered quickly enough and the search cannot find the control, this happens on clicks as well, i.e the playback is trying to click a control, i.e. a button which may not have rendered yet, I've corrected this via manually adding ThinkTime between steps, but it feels like a hack. As a coded ui test is procceeding, is there a way to tell Playback to wait until the controls are rendered, I have seen the WaitForControlExist method, but I can't quite figure out where to use it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我实际上找到了一种从配置文件中驱动此操作的方法,而无需在每个步骤后添加手动延迟,以防这对任何人有帮助。它在每个操作之间设置 3 秒 (3000 毫秒) 的等待时间。
I actually found out a way to drive this from the config file without adding manual delays after each step, in case this helps anyone. It sets a 3 second (3000 ms) waittime between each action.