def init_logger(): logdir_path = LoadConfigs.get_testenv_configs().get('logdir_path') logdir_path = logdir_path.replace('{project}', project_path) logfile_path = os.path.join( logdir_path, 'pytest_log_%s.txt' % SysUtils.get_current_date_and_time()) LogManager.build_logger(logfile_path)
def __init__(self, test_pkg_name, run_mins): ''' Constructor ''' self.__test_pkg_name = test_pkg_name self.__run_mins = int(run_mins) cur_time = SysUtils.get_current_date_and_time() self.__log_root_path = os.path.join(os.getcwd(), 'monkeyreports') self.__log_dir_path_for_win = os.path.join(self.__log_root_path, cur_time) self.__log_dir_path_for_shell = '/data/local/tmp/monkey_test_logs' self.__exec_log_path = os.path.join(self.__log_dir_path_for_win, 'run_log.log') self.__device_props_file_path = os.path.join( self.__log_dir_path_for_win, 'device_props.log') self.__app_dump_file_path = os.path.join(self.__log_dir_path_for_win, 'app_info.log') self.__monkey_log_path_for_shell = '%s/%s' % ( self.__log_dir_path_for_shell, 'monkey_log.log') self.__logcat_log_path_for_shell = '%s/%s' % ( self.__log_dir_path_for_shell, 'logcat_full_log.log') self.__logcat_exception_file_name = 'logcat_exception.log' self.__logcat_exception_path_for_shell = '%s/%s' % ( self.__log_dir_path_for_shell, self.__logcat_exception_file_name) self.__logcat_anr_file_name = 'logcat_anr.log' self.__logcat_anr_path_for_shell = '%s/%s' % ( self.__log_dir_path_for_shell, self.__logcat_anr_file_name) SysUtils.create_dir(self.__log_dir_path_for_win) self.__logger = LogManager.build_logger(self.__exec_log_path) self.__sysutils = SysUtils() self.__adbutils = AdbUtils() self.__monitor = MonkeyMonitor() self.__profile_monitor = ProfileMonitor( Constants.ITEST_COLLECT_INTERVAL) self.__chart_parser = ChartParser(self.__log_dir_path_for_win) self.__report = MonkeyReport(self.__log_dir_path_for_win, self.__logcat_exception_file_name, self.__logcat_anr_file_name)