useblocks / sphinx-test-reports

Documents test-results inside Sphinx
https://sphinx-test-reports.readthedocs.io/en/latest/
MIT License
28 stars 21 forks source link

CapserJs test report issue #38

Open Nipserk opened 2 years ago

Nipserk commented 2 years ago

Hi there,

I found an issue about the rendered documentation through the make docs-html target on the current master commit b28c01e5b58c57c6fe0b318755779dd42108fcf7.

This issue is located in the topic Test framework related examples for the CasperJs one : only one testsuite is captured within test report, whereas all test suites are effectively described on the website (see attached screenshot, left is website, right is what my local build produced).

image

After digging a bit the codebase, and watch how casperjs.xml is built, I pointed out the following line which seems to be the one leading to this behaviour, within junitparser.py:26 :

if self.junit_xml_object.tag == "testsuites":
    self.junit_xml_object = self.junit_xml_object.testsuite

So two questions arise :

  1. Is there a python dependency missing somewhere is my environment so that the testsuites XML tag is parsed differently ?
  2. If not, how comes that this topic on the website is accuretaly rendered ?

The following quick workaround fixes this issue, but I'm not 100% sure of any side effects :

+++ aggron/junitparser.py   2022-07-11 14:11:20.080362490 +0200
@@ -131,8 +131,9 @@
         # main flow starts here

         junit_dict = []
-        complete_testsuite = parse_testsuite(self.junit_xml_object)
-        junit_dict.append(complete_testsuite)
+        for o in self.junit_xml_object:
+            complete_testsuite = parse_testsuite(o)
+            junit_dict.append(complete_testsuite)

         return junit_dict

Thanks for your help :slightly_smiling_face: