def main(): parser = argparse.ArgumentParser() parser.add_argument("-c", "--config", help="Path to alternative config file") parser.add_argument("-k", "--trkey", help="TestCycle key to post results into") args = parser.parse_args() config_path = args.config if args.config else None config = read_config(config_path) key = args.trkey if args.trkey else None logger = get_logger(__name__, config) try: r_config = config['ROCS'] testcycle_name = config['EXECUTION']['testcycleName'] artifact_path = get_full_path(base_path=r_config['pathToArtifact'], use_relative_path=True) if r_config['getResultsFromBamboo'] == 'True': get_build_artifact(r_config['bambooBuildLink'], artifact_path) j_parser = RocsParser(artifact_path=artifact_path, testcycle_name=testcycle_name, testcycle_key=key, config_path=config_path) j_parser.read_files() j_parser.do_export_results() except Exception as e: logger.exception(e)
def test_get_bamboo_artifact(self): build_url = self.parseconfig['ROCS']['bambooBuildLink'] artifact_path = get_full_path(rocs_config['pathForBambooArtifact'], True) get_build_artifact(build_url, artifact_path) self.assertTrue(exists(artifact_path)) remove(artifact_path)
def setUpClass(cls) -> None: # copy blank feature files source = get_full_path(base_path=bdd_config['featuresSrc'], use_relative_path=True) destination = get_full_path(base_path=bdd_config['featuresDst'], use_relative_path=True) try: shutil.rmtree(destination) except Exception as e: pass shutil.copytree(source, destination) cls.parseconfig = read_config(bdd_config['configPath']) cls.files_list = get_list_of_feature_files_to_proceed(cls.parseconfig) cls.bdd_parser = BddParser(bdd_config['configPath']) cls.bdd_parser.read_files(cls.files_list) cls.allParseResults = list() cls.destination = destination
def setUpClass(cls) -> None: cls.parseconfig = read_config(rocs_config['configPath']) cls.artifact_path = get_full_path( cls.parseconfig['ROCS']['pathToArtifact'], True) cls.rocs_parser = RocsParser( artifact_path=cls.artifact_path, config_path=rocs_config['configPath'], testcycle_name=cls.parseconfig['EXECUTION']['testcycleName'])
def setUpClass(cls) -> None: cls.parseconfig = read_config(rocs_config['configPath']) cls.artifact_path = get_full_path( cls.parseconfig['ROCS']['pathToArtifact'], True) cls.rocs_parser = RocsParser( artifact_path=cls.artifact_path, config_path=rocs_config['configPath'], testcycle_name=cls.parseconfig['EXECUTION']['testcycleName']) cls.rocs_parser.tm = mocked_tm4j cls.allParseResults = list() cls.current_result = None cls.rocs_parser.read_files()
def get_list_of_feature_files_to_proceed(config, diff: str = None) -> list: """ function returns list of feature files to proceed basing on config settings :param config: :param diff: abs path to alternate diff file :return: list of feature file paths either all or modified """ logger.info(f'Getting list of feature files to proceed') bdd_config = config['BDD'] updated_files_list = [] use_relative_path = bool(config['GENERAL']['useRelativePath']) features_folder = get_full_path( bdd_config['localRepoRoot'], use_relative_path, bdd_config['featuresFolderInLocalRepository']) files_list = get_list_of_files(features_folder, '.feature', use_relative_path) if bdd_config['diffTestsUpdate'] == 'True': diff_file = diff if diff else get_full_path( bdd_config['localRepoRoot'], use_relative_path, bdd_config['diffFilePath']) diff_file = try_file_exists(diff_file, '', logger, use_relative_path, True) modified_files = parse_log(diff_file) modified_feature_files = list( filter(lambda x: '.feature' in x, modified_files)) for modified_file in modified_feature_files: try: updated_files_list.append( find_file_in_list_by_name(modified_file, files_list, bdd_config, True)) except FileNotFoundError: logger.error( f'File {modified_file} was not found locally, skipping...') logger.info( f'Diff_file {diff_file}. Diff feature files: {modified_feature_files}' f'. Updated_files_list: {updated_files_list}') return remove_duplicates(updated_files_list) logger.info(f'Files_list: {files_list}.') return files_list
def tearDownClass(cls) -> None: destination = get_full_path(base_path=bdd_config['featuresDst'], use_relative_path=True) shutil.rmtree(destination)
def client_path(self): return get_full_path(self.filename)
def __init__(self, testcycle_name: str, config_path: str = None, testlogs_path: str = None): super().__init__(config_path) self.testcycle_name = testcycle_name # logs are provided as single file, attached to TestCycle, parsed and inserted as comment into test execution self.testlogs_path = get_full_path(testlogs_path, self.config['GENERAL']['useRelativePath']) self.test_logs = parse_test_log(self.testlogs_path) if testlogs_path else None
def client_path(self): return get_full_path(self.filename)
def image_link(self): return get_full_path(self.image_file)
def image_link(self): return get_full_path(self.image_file)