typhoon-hil / allure-docx

docx report generation based on allure-generated json files
MIT License
30 stars 14 forks source link

Error: ZeroDivisionError: division by zero #15

Closed Vinodkumar545 closed 6 years ago

Vinodkumar545 commented 6 years ago

Hi,

I have followed the instruction of allure-docx and when tried to execute it, I faced an error - ZeroDivisionError: division by zero. Below are images of folder structure and errors.

Command Run1: ...\Capture> python -m pytest TestSuite.py --alluredir ./results ...\Capture> allure serve ./results/ ...\Capture> Ctrl + C ...\Capture> allure-docx ./results/ allure_rep.doc Error!!!

Command Run2: ...\Capture> allure-docx--help All help command displayed ...\Capture>allure-docx C:\User......\allure-report allure_rep.docx Error!!

Could you please let us know what wrong am I doing here? I even tried to provide the 'allure-report' as alluredir but still the same error. I'm currently using Python 3.6.4, pytest 3.6.0, py-1.5.3, allure-adaptor-1.7.10

capture1 capture2

Vinodkumar

Sup3rGeo commented 6 years ago

Hi @Vinodkumar545, thanks for the report!

The current version was only tested against allure-pytest, which generates files named xxx-result.json as test results. It seems you don't have any file named like that.

Which is the testing framework you are using to generate the report results folder?

Anyways, we should implement some graceful messages in case we don't find any results in the format we expect. That's why it is dividing by zero.

Vinodkumar545 commented 6 years ago

Hi @Sup3rGeo, thanks for the response.

I currently have a class 'TestCase01.py' which is a unittest.TestCase with allure functions called. And this class is executed by a class 'TestSuite.py' which is unittest.TestSuite.

And i'm currently execution as per this article published - http://qaboy.com/2018/01/08/setup-test-reports-selenium-using-python-allure/

Please let me know if I have to run some other commands to work for allure-docx.

Vinodkumar545 commented 6 years ago

Hey, since you mentioned this only works for allure-pytest. So, I uninstalled allure-pytest-adaptor and installed allure-pytest.

For the same project, I ran command - py.test --alluredir ./allure-results TestSuite.py and I was able to see xxxx-results.json file in the folder, which is good!

Now, i ran command - _allure-docx ./allure-results allurerep.docx but I got the following error.

From the error, I understand it has something to do it cairosvg package. As mentioned in the requirement, I have installed and have added the PATH. i.e, C:\Users\Rajshekhar\Desktop\Stride.AI\soft\cairo-windows-1.15.10\lib

Is there anything wrong I'm doing to generate the report docx? Please let me know. Thanks!

image

Sup3rGeo commented 6 years ago

Great to hear progress!

Because we supply 32-bit executables, make sure the 32-bit version (from the x86 folder) of cairo.dll is in the root of that folder.

Or, conversely, just add the x86 folder to PATH instead.

Vinodkumar545 commented 6 years ago

Thanks for the response! But, still no luck.

Below are the steps I followed:

  1. Downloaded the zip file 'cairo-windows-1.15.10.zip' from the link provided https://github.com/preshing/cairo-windows/releases
  2. Unzipped the file
  3. Add path folder 'C:xxx\xxxxx\xxxx\soft\cairo-windows-1.15.10\lib\x86' in the environment.

And ran below command:

  1. command - python -m python TestSuite.py --alluredir ./allure-results
  2. 'allure-results' folder was created and could see xxxx-result.json file
  3. Command - _'allure-docx ./allure-results allurerep.docx Faced the same OSError as below. image
Sup3rGeo commented 6 years ago

Sorry for the delay. You could try with the x64 dll in path then?

Actually based on the feedback I had so far, probably the next iteration I will look towards packing the cairo dll in the executable so there will be no more need to install it separately. It should avoid the kind of problems you are having.

Sup3rGeo commented 6 years ago

Could you try with the new release? https://github.com/typhoon-hil/allure-docx/releases/tag/v0.3.0

It has Cairo bundled, so you should not have any more problems.

Sup3rGeo commented 6 years ago

@Vinodkumar545 I will close this as inactive. You can check the latest 32-bit executable that has dlls bundled: https://github.com/typhoon-hil/allure-docx/releases/tag/v0.3.2