From 81ca28e2db1d1a8279a5feb3586b9a28e7a49d09 Mon Sep 17 00:00:00 2001 From: Marko Mecina <marko.mecina@univie.ac.at> Date: Mon, 19 Jun 2023 17:08:07 +0200 Subject: [PATCH] fix function naming in generated automated test scripts + add config block for test setup --- Tst/tst/generator.py | 4 ++-- Tst/tst/generator_templates/co_step.py | 6 +++--- Tst/tst/generator_templates/run_header.py | 17 ++++++++++------- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/Tst/tst/generator.py b/Tst/tst/generator.py index 76cea11..f3821b6 100644 --- a/Tst/tst/generator.py +++ b/Tst/tst/generator.py @@ -33,7 +33,7 @@ def create_file_name(name): :param str name: the name which should be transformed into a valid file name """ assert isinstance(name, str) - file_name = name.replace(' ', '_') + file_name = name.replace(' ', '_').replace('-', '_') file_name = file_name.lower() return file_name @@ -51,7 +51,7 @@ def create_class_name(name): """ Take the name of the test specification and make a valid python class name out of it :param str name: the name of the test specification""" assert isinstance(name, str) - class_name = name.replace(' ', '') + class_name = name.replace(' ', '').replace('-', '_') return class_name diff --git a/Tst/tst/generator_templates/co_step.py b/Tst/tst/generator_templates/co_step.py index 87902bf..d1cb1e9 100644 --- a/Tst/tst/generator_templates/co_step.py +++ b/Tst/tst/generator_templates/co_step.py @@ -22,8 +22,8 @@ step_end_cuc = cfl.get_last_pckt_time(pool_name=pool_name, string=False) report.command_step_end(step_param=param, step_end_cuc=step_end_cuc, step_id=step_id) - summary =self.step_verification(pool_name=pool_name, step_start_cuc=step_start_cuc, param=param, summary=summary, - ver_file=${testSpecFileName}_verification, ver_class="${testSpecClassName}Verification", - ver_func="step_${testStepNumber}", step_id=step_id) + summary = self.step_verification(pool_name=pool_name, step_start_cuc=step_start_cuc, param=param, summary=summary, + ver_file=${testSpecFileName}_verification, ver_class="${testSpecClassName}Verification", + ver_func="step_${testStepNumber}", step_id=step_id) return summary diff --git a/Tst/tst/generator_templates/run_header.py b/Tst/tst/generator_templates/run_header.py index e10e981..d9540f3 100644 --- a/Tst/tst/generator_templates/run_header.py +++ b/Tst/tst/generator_templates/run_header.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# this script should provide an easy way to execute single steps of the test IASW_1_DB +# this script should provide an easy way to execute single steps of a test import logging import threading import os @@ -27,12 +27,15 @@ import ${testSpecFileName}_verification importlib.reload(${testSpecFileName}_command) importlib.reload(${testSpecFileName}_verification) -# create a instance of the test and the verification +# create an instance of the test and the verification testinstance = ${testSpecFileName}_command.${testSpecClassName}(do_verification=True) verification_instance = ${testSpecFileName}_verification.${testSpecClassName}Verification() -# define the pool name -pool_name = 'new_tmtc_pool' +# SETUP +pool_name = 'LIVE' +save_pool = False +verify_offline = False +interactive = False #! CCS.BREAKPOINT # run the whole test @@ -40,13 +43,13 @@ threading.Thread(target=testinstance.run, kwargs={'pool_name': pool_name}, daemon=True).start() -if False: +if save_pool: # Save the pool to a file threading.Thread(target=testinstance.save_pool_in_file, kwargs={'pool_name': pool_name, 'save_pool': True}, daemon=True).start() -if False: +if verify_offline: # do Verification of command log file and saved pool threading.Thread(target=verification_instance.verify, kwargs={'command_log_file':'logs_test_runs/Simple_Example_command_cmd.log', @@ -58,6 +61,6 @@ if False: # Run the test step by step #! CCS.BREAKPOINT -if False: +if interactive: # Pre-Conditions: $TestPreconDescription threading.Thread(target=testinstance.establish_preconditions, kwargs={'pool_name': pool_name}, daemon=True).start() -- GitLab