3

I have installed pytest-html and want to use it generate html report after run pytest in pycharm.

like this: configure

but it pops error:

ERROR: file not found: html=report\result.html

after run. So how to modify the arguments?

Harjeb
  • 105
  • 2
  • 9

3 Answers3

6

use

--html=Reports/Report.html  --self-contained-html

in additional argument section of pycharm

lczapski
  • 4,026
  • 3
  • 16
  • 32
0

If your using terminal to run the test try this instead this will work .

py.test --html=demoreport.html 
manoj
  • 121
  • 3
  • 14
0

If you want to run via pycharm, just by Right click on the project, follow below steps:

  1. Add new configuration in Pycharm: At Configuration popup: Click '+', Python tests->pytest, provide "working directory" and "target" values with the path of the project.
  2. Then after, Create a new file pytest.ini in the root folder of the project and provide the below values:

     [pytest]
     addopts = --html=reports/Report.html
     python_files = tests/*.py
    

where, tests/*.py is a folder which contains all tests.

Now, just right click on your project and select Run 'pytest in ProjectFolderName' and you will find that report is created inside reports folder with name Report.html