def get_test_variants(self): """Computes test variants based on the parameters""" if self.test_parameters: paths = ['/'] tree_nodes = TreeNode().get_node(paths[0], True) tree_nodes.value = self.test_parameters variant = { "variant": tree_nodes, "variant_id": None, "paths": paths } test_variant = [(test, variant) for test in self.tests] else: # let's use variants when parameters are not available # define execution order execution_order = self.config.get('run.execution_order') if execution_order == "variants-per-test": test_variant = [(test, variant) for test in self.tests for variant in self.variants.itertests()] elif execution_order == "tests-per-variant": test_variant = [(test, variant) for variant in self.variants.itertests() for test in self.tests] return test_variant
def _get_all_runtime_tasks(self, test_suite, job_id): runtime_tasks = [] test_result_total = test_suite.variants.get_number_of_tests(test_suite.tests) no_digits = len(str(test_result_total)) if test_suite.test_parameters: paths = ['/'] tree_nodes = TreeNode().get_node(paths[0], True) tree_nodes.value = test_suite.test_parameters variant = {"variant": tree_nodes, "variant_id": None, "paths": paths} test_variant = [(test, variant) for test in test_suite.tests] else: # let's use variants when parameters are not available # define execution order execution_order = test_suite.config.get('run.execution_order') if execution_order == "variants-per-test": test_variant = [(test, variant) for test in test_suite.tests for variant in test_suite.variants.itertests()] elif execution_order == "tests-per-variant": test_variant = [(test, variant) for variant in test_suite.variants.itertests() for test in test_suite.tests] # decide if a copy of the runnable is needed, in case of more # variants than tests copy_runnable = len(test_variant) > len(test_suite.tests) # create runtime tasks for index, (runnable, variant) in enumerate(test_variant, start=1): if copy_runnable: runnable = deepcopy(runnable) runtime_tasks.extend(self._create_runtime_tasks_for_test( test_suite, runnable, no_digits, index, variant, job_id)) return runtime_tasks