我正在使用py测试诱惑适配器并尝试生成诱惑报告所需的输入数据。但我无法生成任何XML。当我使用py.test sample.py执行py文件时,它确实创建了pycache目录。然后我执行了“诱惑生成-v 1.3.9 C:\ allurereports”(这是我有sample.py的目录)。它确实创建了一个诱人的HTML报告,但没有测试用例是0.没有详细信息。
sample.py(与示例中给出的相同)
import allure
@allure.feature('Feature1')
@allure.story('Story1')
def test_minor():
assert False
@allure.feature('Feature2')
@allure.story('Story2', 'Story3')
@allure.story('Story4')
class TestBar:
# will have 'Feature2 and Story2 and Story3 and Story4'
def test_bar(self):
pass
这是使用的py.test命令:py.test sample.py --allure_features = feature1,feature2
任何人都可以帮我如何从文件中生成一个诱惑报告。有哪些命令要执行。
Lavanya。我将尝试解释您必须执行的序列,以生成自动测试的诱惑报告。
*注意<some directory>对于所有步骤都是相同的
您应该使用测试数据(包含-testsuite.xml文件的目录)指定目录,而不是测试目录。
您可以使用py.test --alluredir [path_to_report_dir]
来指定它。
PS。确保使用正确的诱惑版本(最新的pytest适配器仅支持诱惑1.4。*)。
有关更多信息,请参阅https://github.com/allure-framework/allure-python和https://github.com/allure-framework/allure-cli
现在你必须使用allure-command-line而不是allure-cli来生成html-report,因为第二个被弃用了。
通过诱惑生成报告的方法非常简单。
首先安装诱惑。 (1)allure-pytest 2.6.0(2)allure-python-commons 2.6.0
然后,如果您无法生成报告,请按照以下步骤操作..步骤-1(使用pytest)pytest test_xyz.py --alluredir =您要保存报告的路径。
step -2 allure serve report_path
如果仍然显示诱惑是不被认可的命令(blah -blah)
然后使用npm插件和下面的命令安装诱惑
npm install -g allure-commandline --save-dev
然后再次按照步骤2,然后一个服务器将启动,您可以看到诱惑报告。
这是我发现的工作 -
python3 -m pytest [your_test_class_name] --alluredir \Report
然后执行保存报告的以下行 -
python3 -m allure serve \Report
这将在默认浏览器中打开倾城度报告。