Selenium Pytest-未识别的论点HTML报告

发布于 2025-01-29 08:07:00 字数 816 浏览 3 评论 0 原文

我使用Selenium Python创建了一些测试脚本,它们的工作正常。但是,当我尝试生成HTML报告或诱惑报告时,我遇到了麻烦。

我使用以下命令尝试生成pytest html报告:“ pipenv 运行python -m pytest xxx/test_xxxxx.py -html = report “。但是,我收到以下错误:“

ERROR: usage: __main__.py [options] [file_or_dir] [file_or_dir] [...]
__main__.py: error: unrecognized arguments: --html=report.html
  inifile: None
  rootdir: C:\Users\xxxx\xxxx"

。我已经安装了使用PIP Install Pytest-HTML pytest-html 插件的 pytest-html ,所以我不确定我做错了什么。

  • ​-report-html“> pytest:错误:未识别的参数:-html = report.html

有人有任何见解吗?

I created some test scripts using selenium python and they have been working okay. However, I have had trouble when I tried to generate an html report or an allure report.

I used the following command to try to generate a pytest html report: "pipenv run python -m pytest xxx/test_xxxx.py --html=report.html". However, I got the following error: "

ERROR: usage: __main__.py [options] [file_or_dir] [file_or_dir] [...]
__main__.py: error: unrecognized arguments: --html=report.html
  inifile: None
  rootdir: C:\Users\xxxx\xxxx"

. I had installed the pytest-html plugin using pip install pytest-html, so I am not sure what I have been doing wrong.

I tried uninstalling and reinstalling, but that did not work. I also tried the following links (among others):

Does anyone have any insight?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浪菊怪哟 2025-02-05 08:07:00

我想我找到了解决方案。由于我正在使用Pipenv进行测试,因此我也必须通过Pipenv安装依赖项。因此,对于HTML和Allure报告,完整的命令将如下:

pipenv run pip install allure-pytest
pipenv run pip install pytest-html

尝试此操作后,我运行了以前的命令,并且不再遇到问题。

I think I have found the solution. Since I am using pipenv to run my tests, I would have to install the dependencies through pipenv as well. So for the html and allure reports, the full commands would be as follows:

pipenv run pip install allure-pytest
pipenv run pip install pytest-html

After trying this, I ran my previous commands and I no longer got the issue.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文