def get_stm_test_result_throw(): stm_tr = result_obj.get_stm_test_result() if stm_tr is None: """ Log error for now and create result object. """ # raise Exception("Unable to find StmTestResult object") logger.error('Unable to find StmTestResult object, creating one.') stm_tr = result_obj.create_stm_test_result_under_mm() return stm_tr
def add_provider_result(dict_data): """Add provider result to active result object. It is leaf iterator result object in case of iterative test. Do not throw error if result object does not exist. Try to create one and continue. """ logger.info('Add provider result.') # make sure test in created and running. If not do that first. start_test_if_required() result = iterator_utils.get_active_result_object() logger.debug_result_object_info(result) dict_data = result_utils.insert_report_group_if_not_defined(dict_data) result_obj.add_provider_data(result, dict_data)
def test_create_stm_get_stm(stc, resource_cleanup): mm = meth_man_utils.get_meth_manager() assert mm is not None assert result_obj.get_stm_test_result() is None stm_result = mm.GetObject('StmTestResult') assert stm_result is None stm_result = result_obj.create_stm_test_result_under_mm() assert stm_result is not None stm_mm = mm.GetObject('StmTestResult') assert stm_result.GetObjectHandle() == stm_mm.GetObjectHandle() stm3 = result_obj.get_stm_test_result() assert stm3 is not None assert stm_result.GetObjectHandle() == stm3.GetObjectHandle() # check leaf iterator is none assert iterator_utils.get_leaf_iterator() is None # check StmTestResult is active result stm4 = iterator_utils.get_active_result_object() assert stm4 is not None assert stm_result.GetObjectHandle() == stm4.GetObjectHandle()
def get_iterator_result_no_leaf_check(iterator_handle): """Find result with provided handle. Return none if not found. """ stm_result = result_obj.get_stm_test_result() if stm_result is None: return None child_obj = stm_result.GetObject('StmIteratorResult') while child_obj is not None: if child_obj.Get('Iterator') == iterator_handle: return child_obj child_obj = child_obj.GetObject('StmIteratorResult') return None
def test_iterato_utils_create_get(stc, resource_cleanup): # check there are no result objects to start with assert result_obj.get_stm_test_result() is None # create iterator result which should create StmTestResult as well iterator_result_1 = iterator_utils.create_iterator_result() assert iterator_result_1 is not None stm_result = result_obj.get_stm_test_result() assert stm_result is not None parent_1 = iterator_result_1.GetParent() assert parent_1 is not None assert stm_result.GetObjectHandle() == parent_1.GetObjectHandle() # check leaf iterator iterator_result_3 = iterator_utils.get_leaf_iterator() assert iterator_result_3 is not None assert iterator_result_3.GetObjectHandle() == iterator_result_1.GetObjectHandle() # create one more iterator child_1 = iterator_utils.create_iterator_result() assert child_1 is not None # check parent is previous iterator parent_2 = child_1.GetParent() assert parent_2 is not None assert parent_2.GetObjectHandle() == iterator_result_3.GetObjectHandle() # new child should be leaf now child_3 = iterator_utils.get_leaf_iterator() assert child_3 is not None assert child_3.GetObjectHandle() == child_1.GetObjectHandle() # active result is same as well active_1 = iterator_utils.get_active_result_object() assert active_1 is not None assert child_3.GetObjectHandle() == active_1.GetObjectHandle() # reset results result_obj.reset() stm_2 = iterator_utils.get_active_result_object() assert stm_2 is not None assert stm_result.GetObjectHandle() == stm_2.GetObjectHandle() # check there are no iterator results assert iterator_utils.get_leaf_iterator() is None assert stm_2.GetObject('StmIteratorResult') is None
def reset_active_iteration_data(self): self.set_stc_object(self._active_iteration_info.stc_property_name, "") self.set_stc_object(self._active_iteration_status.stc_property_name, "") self.set_stc_object(self.stc_property_child_iterator_data, "") self._stc_result_object.SetCollection(result_obj.get_stc_json_collection_name(), [])