如何使用 Vividus 工具测试下载文件

Iva*_*nin 2 automation ui-automation vividus

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

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

VaL*_*VaL 5

推荐的方法:

  • 在 Web UI 上找到链接
  • 提取链接网址
  • 使用vividus-plugin-rest-api步骤下载文件(您可能还需要使用vividus-plugin-web-app-to-rest-api步骤将 cookie 从浏览器注入 Web UI )
  • 验证 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`
Run Code Online (Sandbox Code Playgroud)