66
77import pytest
88import os
9+ import typing
910from dotenv import load_dotenv
1011from pathlib import Path
12+ from _pytest .python import Function
13+ from pytest_html .report_data import ReportData
1114from utils .load_properties_file import PropertiesFile
1215
16+ # Environment Variable Handling
17+
1318LOCAL_ENV_PATH = Path (os .getcwd ()) / "local.env"
1419
1520
@@ -35,3 +40,27 @@ def smokescreen_properties() -> dict:
3540@pytest .fixture
3641def general_properties () -> dict :
3742 return PropertiesFile ().get_general_properties ()
43+
44+
45+ # HTML Report Customization
46+
47+
48+ def pytest_html_report_title (report : ReportData ) -> None :
49+ report .title = "BCSS Test Automation Report"
50+
51+
52+ def pytest_html_results_table_header (cells : list ) -> None :
53+ cells .insert (2 , "<th>Description</th>" )
54+
55+
56+ def pytest_html_results_table_row (report : object , cells : list ) -> None :
57+ description = getattr (report , "description" , "N/A" )
58+ cells .insert (2 , f"<td>{ description } </td>" )
59+
60+
61+ @pytest .hookimpl (hookwrapper = True )
62+ def pytest_runtest_makereport (item : Function ) -> typing .Generator [None , None , None ]:
63+ outcome = yield
64+ if outcome is not None :
65+ report = outcome .get_result ()
66+ report .description = str (item .function .__doc__ )
0 commit comments