|
Post by account_disabled on Apr 2, 2024 3:42:43 GMT -5
例如当执行考虑多次预订的可能性步骤时它将运行自动代码来创建多个预订。首先我们将创建一个与之前使用的框架类似的框架并在测试文件夹中包含以下包在中我们将创建一个新类其中包含以下内容最后我们需要通过在资源文件夹中创建一个新文件来将示例脚本添加到我们的框架中如下所示如下功能预订报告场景用户请求所有预订的总收入假设我有多个预订当我请求有关我的总收入的报告时那么我将收到基于我所有预订的总金额这意味着当我们运行时测试我们得到步骤我有多个预订未定义。 您可以使用下面的代码片段来实现它在此编写代码将上述短语转换为具体操作类将和我们的功能文件链接在一起允 阿曼数据 许运行文件作为测试。或者您可以通过添加检查来扩展自动化框架以确保已准备好接受请求如可以添加到的处理程序中所示无法连接到尝试响应给定超时限制线程睡眠否则中断异常线程睡眠方法接受和参数用于将请求发送到选定的端点。如果请求由于连接错误而失败或响应未包含状态代码则该方法会计算并等待一秒钟然后重新发送请求。该方法可失败消息指示出现问题。 答案打破了循环这意味着自动检查可以开始。我们可以在处理程序中调用该方法处理程序现在将检查预订是否每秒运行一次持续秒。如果此时尚未运行检查将失败并显示一条消息不可用。值得重复的是这只是使用工具和或库来运行的众多方法之一。主要结论任何无法激活本身的测试自动化系统都应该提供类似的东西。这种方法对某些人来说可能看起来不方便因为它创建了更多的代码来维护和新的潜在错误源。这就是为什么有时值得退后一步看看我们是否可以对上下文进行更改以调整生产和测试自动化代码。这将帮助每个人在未来节省时间。
|
|