Skip to content
Snippets Groups Projects
Commit 9bd3bd07 authored by moeslinged94's avatar moeslinged94
Browse files

Do NOT use this version

TST: Additional Information in progress_view.py for commands and verification, re-arranged the test-command file (steps now easier visible), version/description bug in log file fix
parent 11384e94
No related branches found
No related tags found
No related merge requests found
......@@ -230,7 +230,7 @@ class TestProgressView(Gtk.ApplicationWindow):
self.view.append_column(column_type)
# column 4
renderer_cmd_version = Gtk.CellRendererText()
renderer_cmd_version = Gtk.CellRendererText(xalign=0.5)
column_cmd_version = Gtk.TreeViewColumn('Version', renderer_cmd_version, text=3, background=7)
column_cmd_version.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
column_cmd_version.set_resizable(True)
......@@ -603,6 +603,7 @@ class TestProgressView(Gtk.ApplicationWindow):
return row
def add_detailed_row(self, inner_row_iter, tree_store):
detailed_info=[]
for count, item in enumerate(tree_store[inner_row_iter]):
if count in [0,7,9]: # Stepnumber, colour, colour
......@@ -624,7 +625,6 @@ class TestProgressView(Gtk.ApplicationWindow):
detailed_info.append('')
new_row_iter = tree_store.append(inner_row_iter, detailed_info)
new_row = tree_store[new_row_iter]
def load_json(self, filepath):
......@@ -844,6 +844,7 @@ class TestProgressView(Gtk.ApplicationWindow):
else:
self.build_row_list(row=new_row,
result=False)
self.add_detailed_row(new_row_iter, tree_store)
self.restore_expanded_states(tree_store)
......
{
"_name": "test",
"_description": "Testing the TST",
"_version": "2",
"_primary_counter_locked": false,
"_precon": "",
"_postcon": "",
"sequences": [
{
"_sequence": 0,
"_name": "",
"_description": "",
"_version": "",
"_primary_counter_locked": false,
"steps": [
{
"_primary_counter": 1,
"_secondary_counter": 0,
"_step_number": "1.0",
"_description": "Increase the HK Frequncy",
"_comment": "",
"_command_code": "cfl.Tcsend_DB('SASW ModHkPeriodCmd', 1, 8, pool_name='new_tmtc_pool')\n",
"_verification_code": "print('Verification')",
"_is_active": true,
"_verified_item": [],
"_start_sequence": null,
"_stop_sequence": null
},
{
"_primary_counter": 2,
"_secondary_counter": 0,
"_step_number": "2.0",
"_description": "This is supposed to be a very long text just to seeeeee how the Progress Viewer View will handle something like this, definetly do not read any further, these are just some random words, the person reading is just wasting time. Now we reached the end. Tahnks for listening",
"_comment": "",
"_command_code": "print('A Lot of code')\nprint('Just some lines')\nprint('get some lines in here')\nprint('There we go')\nprint(' This line is not needed')\nprint('senseless line')\nprint(' This is a verrrrrrrrry long line that doesnt make any sense execept to see how the progress viewer will show this, thanks for reading')\n",
"_verification_code": "print('Verification')\nprint('A Lot of code')\nprint('Just some lines')\nprint('get some lines in here')\nprint('There we go')\nprint(' This line is not needed')\nprint('senseless line')",
"_is_active": true,
"_verified_item": [],
"_start_sequence": null,
"_stop_sequence": null
},
{
"_primary_counter": 3,
"_secondary_counter": 0,
"_step_number": "3.0",
"_description": "Duration Test, Is Progress Viewer automatically updating?",
"_comment": "",
"_command_code": "import time\ntime.sleep(30)",
"_verification_code": "print('Test is working, Progress Viewer is updating')\n",
"_is_active": true,
"_verified_item": [],
"_start_sequence": null,
"_stop_sequence": null
}
]
}
]
}
\ No newline at end of file
......@@ -174,11 +174,11 @@ def write_log_step_footer(step_param, step_result):
def write_log_test_header(test, pool_name):
logger.info('-------------------------------------------------------------------------------')
logger.info('Running test {} version {}\n\t\t\t\t\tpoolname = {}\n\t\t\t\t\tCUC-timestamp of test '
logger.info('Running test {}\n\t\t\t\t\tversion {}\n\t\t\t\t\tpoolname = {}\n\t\t\t\t\tCUC-timestamp of test '
'start = {}\n\t\t\t\t\tlocal time = {}'
.format(test.id, test.version, pool_name, cfl.get_last_pckt_time(pool_name=pool_name, string=False),
datetime.datetime.now().isoformat()))
logger.info('Description:\n\t\t\t\t\t {}'.format(test.description))
logger.info('#Description: {} \n'.format(test.description))
if test.comment:
logger.info('Comment: {}'.format(test.comment))
......@@ -206,9 +206,9 @@ def write_log_test_footer(test):
logger.info('{} step {} OK'.format(test.id, item.step))
logger.info('~~~~~~~~~~~~~~~~~~~~~~~~~')
if test.test_passed is not False and successful_steps == test.number_of_steps:
logger.info('Test {} OK {}/{} steps successful'.format(test.id, successful_steps, test.number_of_steps))
logger.info('Test {} OK {}/{} steps ran sucessfully'.format(test.id, successful_steps, test.number_of_steps))
else:
logger.info('Test {} FAILED! {}/{} steps successful'.format(test.id, successful_steps, test.number_of_steps))
logger.info('Test {} FAILED! {}/{} steps ran sucessfully'.format(test.id, successful_steps, test.number_of_steps))
logger.info('-------------------------------------------------------------------------------\n\n\n')
return successful_steps
......
......@@ -137,8 +137,8 @@ def make_command_script(model, model_spec):
cls = class_str.substitute(testSpecClassName=create_class_name(model_spec.name),
testSpecFileName=create_file_name(model_spec.name),
testSpecName=model_spec.name,
testSpecDescription=model.description,
testSpecVersion=model.version)
testSpecDescription=model_spec.description,
testSpecVersion=model_spec.version)
# add the header string
content += '\n\n' + cls
......@@ -300,8 +300,8 @@ def make_verification_script(model, model_spec):
cls = class_str.substitute(testSpecClassName=create_class_name(model_spec.name),
testSpecFileName=create_file_name(model_spec.name),
testSpecName=model_spec.name,
testSpecDescription=model.description,
testSpecVersion=model.version)
testSpecDescription=model_spec.description,
testSpecVersion=model_spec.version)
# add the header string
content += '\n\n' + cls
......
# VERIFY EVERY STEP ------------------------------------------------------------------------------------------------
def step_verification(self, pool_name, step_start_cuc, param, summary, tc_id, ver_file, ver_class, ver_func):
"""
This functions does the verification for every step
:param pool_name: str
Name of the datapool for TM/TCs in the database
:param step_start_cuc: time
Time when the step started
:param param: list
Includes the parameters of the step
:param summary: report.StepSummary class object
Containes a summary of the test
:param tc_id:
:param ver_instance: class Instance definition
If called the verification class is initialized
:param ver_instance: func
If called the verification function is called
:return: summary :report.StepSummary class object
Containes a summary of the test
"""
if self.do_verification:
# execute the verification function for this step from the verification script
logger.info('Doing verification for step {}'.format(param['step_no']))
try:
ver_instance_call = getattr(ver_file, ver_class)
instance = ver_instance_call()
ver_func_call = getattr(instance, ver_func)
success = ver_func_call(pool_name, start_cuc=step_start_cuc, tc_id=tc_id)
summary.result = success
except:
logger.exception('Exception in the Verification for Step {}'.format(param['step_no']))
finally:
testing_logger.cmd_log_handler(__name__)
return summary
# POST-CONDITION ---------------------------------------------------------------------------------------------------
def post_condition(self, pool_name):
"""
......
......@@ -16,3 +16,26 @@
logger.info('establishing preconditions finished')
report.write_precondition_outcome(success)
return success
# INITIALIZE every step --------------------------------------------------------------------------------------------
def begin_steps(self, pool_name, param):
"""
This functions initializes every step, the step itself is done in the step functions
:param pool_name: str
Name of the datapool for TM/TCs in the database
:param param: list
Includes the parameters of the step
:return: step_start_cuc: time
Time of the last incomming package before the step is started/ used as time of step start
:return: summary: report.StepSummary class object
Containes a summary of the test
:return: tc_id:
"""
testing_logger.cmd_log_handler(__name__)
step_start_cuc = cfl.get_last_pckt_time(pool_name=pool_name, string=False)
report.command_step_begin(step_param=param, script_version=self.version(), pool_name=pool_name,
step_start_cuc=step_start_cuc)
summary = report.StepSummary(step_number=param['step_no'])
tc_id = None
return step_start_cuc, summary, tc_id
# STEP ${testStepNumber} --------------------------------------------------------------------------------------------------------
def step_${testStepNumber}(self, pool_name):
testing_logger.cmd_log_handler(__name__)
param = {
'step_no': '$testStepNumber',
'msg': '$testStepDescription',
'comment': '$testStepComment'
}
step_start_cuc = cfl.get_last_pckt_time(pool_name=pool_name, string=False)
report.command_step_begin(step_param=param, script_version=self.version(), pool_name=pool_name, step_start_cuc=step_start_cuc)
step_start_cuc, summary, tc_id = self.begin_steps(pool_name=pool_name, param=param)
summary = report.StepSummary(step_number=param['step_no'])
tc_id = None
try:
########---The defined step starts here---########
......@@ -26,15 +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)
if self.do_verification:
# execute the verification function for this step from the verification script
logger.info('Doing verification for step {}'.format(param['step_no']))
try:
instance = ${testSpecFileName}_verification.${testSpecClassName}Verification()
success = instance.step_${testStepNumber}(pool_name, start_cuc=step_start_cuc, tc_id=tc_id)
summary.result = success
except:
logger.exception('Exception in the Verification for Step {}'.format(param['step_no']))
finally:
testing_logger.cmd_log_handler(__name__)
summary =self.step_verification(pool_name=pool_name, step_start_cuc=step_start_cuc, param=param, tc_id=tc_id,
summary=summary, ver_file=${testSpecFileName}_verification,
ver_class="${testSpecClassName}Verification", ver_func="step_${testStepNumber}")
return summary
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment