首页 > 解决方案 > 如何使用 Vividus 工具测试下载文件

问题描述

我正在使用Vividus来测试我的应用程序。

单击下载按钮后,如何测试文件是否已下载?

标签: automationui-automationvividus

解决方案


推荐的方法:

  • 在 Web UI 上找到链接
  • 提取链接 URL
  • 使用vividus-plugin-rest-api步骤下载文件(您可能还需要使用步骤将 cookie 从浏览器注入 Web UI vividus-plugin-web-app-to-rest-api
  • 验证 HTTP 响应代码和内容

实现示例:

When I set 'href' attribute value of the context element to the 'scenario' variable 'file-to-download'
When I set browser cookies to the API context
When I issue a HTTP GET request for a resource with the URL '${file-to-download}'
Then `${responseCode}` is equal to `200`

推荐阅读