pywright-cucumber/behave_runner.py
Greg Gauthier 8749d7ab37
All checks were successful
Pylint / build (3.12) (push) Successful in 19s
initial commit
2024-07-24 21:25:00 +01:00

27 lines
838 B
Python

import os
import subprocess
from datetime import datetime
def execute_features():
"""
Method helps to run the feature files and generate the BDD report
:return:
"""
report_directory = "reports"
current_directory = os.getcwd()
new_folder_path = os.path.join(current_directory, report_directory)
if not os.path.exists(new_folder_path):
os.mkdir(new_folder_path)
htmlpath = os.path.join(report_directory, 'Test_Automation_Report_'\
+ datetime.now().strftime("%d-%m-%Y %H-%M-%S") + ".html")
command = ["behave", "-f", "html-pretty", "-o", htmlpath]
subprocess.run(command, check=True)
print("Test cases are executed successfully. The report will be available at " + htmlpath)
if __name__ == '__main__':
execute_features()