编码 UI 测试动态控件

发布于 2024-11-18 01:02:12 字数 483 浏览 1 评论 0原文

我记录了几个编码的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

萌吟 2024-11-25 01:02:12

我实际上找到了一种从配置文件中驱动此操作的方法,而无需在每个步骤后添加手动延迟,以防这对任何人有帮助。它在每个操作之间设置 3 秒 (3000 毫秒) 的等待时间。

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="DelayBetweenActions" value="3000" />
    <add key="WaitForReadyTimeout" value="60000"/>
  </appSettings>
</configuration>

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.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="DelayBetweenActions" value="3000" />
    <add key="WaitForReadyTimeout" value="60000"/>
  </appSettings>
</configuration>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文