如何在诱惑框架中将文件附加到pytest测试中

问题描述 投票:0回答:1

我如何将文件附加到测试中。例如,我想添加kml文件(一种XML表示法,用于在二维地图和三维Earth浏览器中表达地理注释和可视化)。有什么主意吗?

allure
1个回答
0
投票

使用allure.attach,您可以将html内容添加到所进行的任何测试中。

def test_multiple_attachments():
    allure.attach.file('./data/totally_open_source_kitten.png', attachment_type=allure.attachment_type.PNG)
    allure.attach('<head></head><body> a page </body>', 'Attach with HTML type', allure.attachment_type.HTML)

Read the docs

<script>
      var map;
      var src = 'https://developers.google.com/maps/documentation/javascript/examples/kml/westcampus.kml';

[Here您有一个教程如何在HTML文件中显示* .kml内容。

© www.soinside.com 2019 - 2024. All rights reserved.