예제 #1
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("-n", "--tc_name", help="Test cycle name")
    parser.add_argument("-p",
                        "--j_path",
                        help="Path to json file or folder with files")
    parser.add_argument("-c",
                        "--config",
                        help="Path to alternative config file")
    args = parser.parse_args()
    config_path = args.config if args.config else None
    config = read_config(config_path)
    logger = get_logger(__name__, config)
    try:
        json_path = args.j_path if args.j_path else config['JSON']['jsonPath']
        fh = FilesHandler(config, json_path)
        testcycle_name = args.tc_name if args.tc_name else config['JSON'][
            'testcycleName']
        files_list = fh.get_list_of_files('json')
        logger.info(f'Starting to parse json results. '
                    f'Config path: {config_path}  '
                    f'Tescycle name: {testcycle_name}  '
                    f'Files to proceed: {files_list}  ')
        j_parser = JsonParser(testcycle_name, config_path)
        j_parser.read_files(files_list)
        j_parser.do_export_results()
    except Exception as e:
        logger.exception(e)
예제 #2
0
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)
예제 #3
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("-n", "--tc_name", help="Test cycle name")
    parser.add_argument("-p",
                        "--j_path",
                        help="Path to json file or folder with files")
    parser.add_argument("-l", "--logs", help="Path to test execution logs")
    parser.add_argument("-c",
                        "--config",
                        help="Path to alternative config file")
    args = parser.parse_args()
    config_path = args.config if args.config else None
    config = read_config(config_path)
    logger = get_logger(__name__, config)
    try:
        junit_path = args.j_path if args.j_path else config['JUNIT'][
            'junitPath']
        fh = FilesHandler(config, junit_path)
        testcycle_name = args.tc_name if args.tc_name else config['EXECUTION'][
            'testcycleName']
        logs_path = args.logs if args.logs else \
            (config['JUNIT']['pathToLogs'] if config['JUNIT']['pathToLogs'] != '' else None)
        files_list = fh.get_list_of_files('xml')
        logger.info(f'Starting to parse json results. '
                    f'Config path: {config_path}  '
                    f'Tescycle name: {testcycle_name}  '
                    f'Logs path: {logs_path}   '
                    f'Files to proceed: {files_list}  ')
        j_parser = JunitParser(testcycle_name, config_path, logs_path)
        j_parser.read_files(files_list)
        j_parser.do_export_results()
    except Exception as e:
        logger.exception(e)
예제 #4
0
 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'])
예제 #5
0
 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()
예제 #6
0
 def __init__(self, config_path: str = None):
     self.config_path = config_path
     self.config = read_config(config_path)
     self.logger = get_logger(__name__, self.config)
     self.tm = TM4J(self.config_path)
     self.file = None
     self.file_contents = list()
     self.parse_results = list()
     self.export_results = {
         'Files read': 0,
         'Results found': 0,
         'Exported': 0,
         'Failed': 0
     }
예제 #7
0
 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
예제 #8
0
def main():
    global logger
    parser = argparse.ArgumentParser()
    parser.add_argument("-c",
                        "--config",
                        help="Path to alternative config file")
    parser.add_argument("-d", "--diff", help="Path to diff file to proceed")
    args = parser.parse_args()
    config_path = args.config if args.config else None
    diff_path = args.diff if args.diff else None
    config = read_config(config_path)
    logger = get_logger(__name__, config)
    try:
        files_list = get_list_of_feature_files_to_proceed(config=config,
                                                          diff=diff_path)
        bdd_parser = BddParser(config_path)
        bdd_parser.read_files(files_list)
        bdd_parser.do_export_results()
    except Exception as e:
        logger.exception(e)
예제 #9
0
    def __init__(self, config_path=None):
        self.config = read_config(config_path)
        self._baseurl = self.config['GENERAL']['tm4jUrl']
        self._serviceurl = self._baseurl.replace("atm", "tests")
        self._jira_url = self._baseurl.replace('atm/1.0', 'api/2')
        self._login = self.config['GENERAL']['tm4jLogin']
        self._password = self.config['GENERAL']['tm4jPassword']
        self.project_key = self.config['GENERAL']['tm4jProjectKey']
        self.logger = get_logger(__name__, self.config)
        self._session = Session()
        self._session.auth = (self._login, self._password)
        self._testResultsId = None
        self.testcase = None
        self._tc_internal_id = None
        self.testrun = None
        self._tr_internal_id = None
        self._init_testcase()
        self._init_testrun()

        url = f'{self._serviceurl}/project'
        projects = self._do('get', url, '')

        self._tc_project_id = int(
            [x for x in projects if x['key'] == self.project_key][0]['id'])
예제 #10
0
def cli(ctx):
    ctx.obj['cfg'] = read_config()
    ctx.obj['api'] = API(ctx.obj['cfg'])
def usage(c):
    print 'Usage: # python %s <storage_container> <acl:0/1>' % c
    print '         acl: 0 - private, 1 - public'

if __name__ == '__main__':
    # add python running path
    sd = os.path.dirname(__file__)
    sys.path.append(sd)

    argvs = sys.argv
    argc = len(argvs)
    if (argc !=3 ):
        usage(argvs[0])
        quit()
    container_name = argvs[1]
    acl = int(argvs[2])
    if acl != 0 and acl !=1:
        usage(argvs[0])
        quit()
        
    config = config.read_config(config_file)
    try:
        api = storage.BlobStorageContainer(
                config["ACCOUNT_NAME"],config["ACCOUNT_KEY"],container_name)
        if acl == 1:
            api.set_container_acl_public()
        else:
            api.set_container_acl_private()
    except Exception as e:
        print ("Exception occurd during storage api execution!")
예제 #12
0
 def setUpClass(cls) -> None:
     cls.parseconfig = read_config(tm_config['configPath'])
     cls.tm = TM4J(tm_config['configPath'])