简体   繁体   English

使用Python行为生成静态HTML结果报告

[英]Generate static HTML results report with Python Behave

I use behave to run a set of e2e tests for my software, eg: 我使用行为为我的软件运行一组e2e测试,例如:

behave ./tests/ --tags=set123 --tags=-skip

When the process ends, a tests/results/ directory is created, plenty of results in the form of .xml files which root element is <testsuite> . 当该过程结束时,将创建一个tests/results/目录,其结果形式为.xml文件,其根元素为<testsuite>

I'd like to have an static HTML report with the result. 我想要一个包含结果的静态 HTML报告。 PyCharm have a nice button to get such report directly, but I wonder about how to get it from the command line. PyCharm有一个不错的按钮可以直接获取此类报告,但我想知道如何从命令行获取它。 I mean, some way of processing the resulting .xml files to render the HTML or (even better) to do it as result of the behave command itself. 我的意思是,由于behave命令本身,以某种方式处理生成的.xml文件以呈现HTML或(甚至更好)进行处理。

Any help, please? 有什么帮助吗? This seems to be conceptually easy but I haven't found any straighfoward solution googling out there... 从概念上讲,这似乎很简单,但是我没有找到任何可以顺其自然地找到解决方法的解决方案...

EDIT: I know the Allure tool. 编辑:我知道诱惑工具。 However, it doesn't fit my purpose as it starts a web server to serve the report and I need an static HTML. 但是,它不适合我的目的,因为它启动了Web服务器来提供报告,并且我需要静态HTML。 I have adjusted the wording of the question to make it clearer. 我已经对问题的措词进行了调整,以使其更清楚。

Well if you don t have a lot of tests you can think on change framework to pytest + pytest_bdd and then you can generate html static reports with pytest-html. 好吧,如果您没有很多测试,可以考虑将框架更改为pytest + pytest_bdd,然后可以使用pytest-html生成html静态报告。 Or even , i don t know if possible , call pytest report from behave 甚至,我不知道是否可以从行为调用pytest报告

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM