Repository: yongchin0821/pywebreport (language: python)

Issue:
参数化运行中，参数中带有.时，报告生成失败
- 用例
```python
import pytest as pytest

class TestApp:
    @pytest.mark.parametrize("url", ['device_address'])
    @pytest.mark.parametrize("case", ["cases.py"])
    def test_ui_app(self, url, case):
        print(url)
        print(case)

if __name__ == '__main__':
    args = ['./', '-q', '--report', 'result/report.html']
    pytest.main(args)
```

- 报错
<img width="995" alt="image" src="https://user-images.githubusercontent.com/29191106/183107687-7a6ae340-c203-48f8-a0c5-43f94d8f3a0f.png">

- 问题
>以`.`分割时，当参数化运行中，参数中带有`.`时，KeyError
https://github.com/yongchin0821/pywebreport/blob/bda6e406fca54d68fc8ef39117be3644d2a1646c/pywebreport/plugins/pytest/htmlreport.py#L77



Discussion / hints:

Fix patch:
diff --git a/.gitignore b/.gitignore
index ff38668..971870e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,8 +6,7 @@ dist
 node_modules
 build
 *.egg-info
-
-
+venv
 __pycache__
 allure-report
 result
diff --git a/setup.py b/setup.py
index 9308a00..d64674b 100644
--- a/setup.py
+++ b/setup.py
@@ -25,7 +25,7 @@
     packages=find_packages(),
     include_package_data=True,
     python_requires=">=3.7",
-    install_requires=["pytest", "pydantic"],
+    install_requires=["pytest", "pydantic", "jinja2"],
     classifiers=[
         "Framework :: Pytest",
         "Topic :: Software Development :: Testing",


Test patch:
diff --git a/pywebreport/plugins/pytest/htmlreport.py b/pywebreport/plugins/pytest/htmlreport.py
index b958091..d82b60c 100644
--- a/pywebreport/plugins/pytest/htmlreport.py
+++ b/pywebreport/plugins/pytest/htmlreport.py
@@ -72,19 +72,14 @@ def pytest_report_collectionfinish(self, config, startdir, items):
         report["suites"] = suitelist
 
     def _record_case(self, results, status):
-        if "." in results.head_line:
-            class_name = results.head_line.split('.')[0]
-            case_name = results.head_line.split('.')[-1]
-        else:
-            class_name = ""
-            case_name = results.head_line
+        case_name = results.case_name
 
         report["suites"][results.fspath]["results"]["counts"] += 1
         report["suites"][results.fspath]["cases"][case_name]["id"] = results.nodeid
         report["suites"][results.fspath]["cases"][case_name]["desc"] = results.desc
         report["suites"][results.fspath]["cases"][case_name]["status"] = status
         report["suites"][results.fspath]["cases"][case_name]["duration"] = round(results.duration, 3)
-        report["suites"][results.fspath]["cases"][case_name]["className"] = class_name
+        report["suites"][results.fspath]["cases"][case_name]["className"] = results.class_name
         report["suites"][results.fspath]["cases"][case_name]["consoleLog"] = results.sections
         report["suites"][results.fspath]["cases"][case_name]["errMsg"] = results.longreprtext
         report["suites"][results.fspath]["cases"][case_name]["execTime"] = results.exec_time
@@ -96,7 +91,9 @@ def pytest_runtest_makereport(self, item, call):
         out = yield
         results = out.get_result()
         results.desc = item.function.__doc__ if item.function.__doc__ is not None else ""
-
+        results.class_name = item.cls.__name__ if item.cls is not None else ""
+        results.case_name = item.name
+        
         if results.when == "setup":
             self._struct_time = time.localtime()