Create argument to specify a single feature in BIMTester, and separate report generation into its own function

This commit is contained in:
Dion Moult
2020-03-06 10:16:30 +11:00
parent 43348ce236
commit 5dd919f028
+10 -3
View File
@@ -14,13 +14,11 @@ import re
from pathlib import Path
def run_tests(args):
behave_args = ['features', '--junit', '--junit-directory', args.junit_directory]
behave_args = [args.feature, '--junit', '--junit-directory', args.junit_directory]
if args.advanced_arguments:
behave_args = args.advanced_arguments.split()
behave_main(behave_args)
print('# All tests are finished.')
if args.report:
generate_report(args)
def generate_report(args):
print('# Generating HTML reports now.')
@@ -31,6 +29,7 @@ def generate_report(args):
for file in os.listdir(args.junit_directory):
if not file.endswith('.xml'):
continue
print(f'Processing {file} ...')
root = ET.parse('{}{}'.format(args.junit_directory, file)).getroot()
data = {
'report_name': root.get('name'),
@@ -117,6 +116,12 @@ parser.add_argument(
type=str,
help='Specify your own JUnit directory',
default='junit/')
parser.add_argument(
'-f',
'--feature',
type=str,
help='Specify a feature to test',
default='features')
parser.add_argument(
'-a',
'--advanced-arguments',
@@ -133,6 +138,8 @@ if not os.path.exists('features'):
if args.purge:
TestPurger().purge()
elif args.report:
generate_report(args)
else:
run_tests(args)