27 lines
838 B
Python
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()
|