def send_reuqest_and_write_response():
    city_ids = g_city_ids
    url = 'http://apis.baidu.com/apistore/weatherservice/recentweathers'
    header_parms = {'apikey':'7705cca8df9fb3dbe696ce2310979a62'}

    file_name = 'baidu_weather_data_update_freq_src_%s.log' % g_cur_date
    file_path = os.path.join(g_log_dir, file_name)

    output_lines = []
    for id in city_ids:
        resp = None
        try:
            resp = HttpJsonUtils.send_get_request_with_header_and_return(url, header_parms, {'cityid':id})
        except Exception, e:
            logging.error('Exception: %s' % e)

        if resp is None:
            return
        line = '%s: %s\n' % (WinSysUtils.get_current_date_and_time(), resp.decode('unicode_escape'))
        output_lines.append(line) 
Ejemplo n.º 2
0
def init_local_report_paths():
    report_dir_name = 'logs_%s' % WinSysUtils.get_current_date_and_time()
    report_dir_path = os.path.join(os.getcwd(), 'logs', report_dir_name)
    global g_local_report_dir_path
    g_local_report_dir_path = report_dir_path

    if not os.path.exists(report_dir_path):
        os.makedirs(report_dir_path)

    global g_local_inst_run_log_file_path
    inst_run_log_file_name = 'InstrutmentRunLog.log'
    g_local_inst_run_log_file_path = os.path.join(report_dir_path, inst_run_log_file_name)
    
    global g_local_test_logging_file_path
    logging_name = 'TestLoggingReport.log'
    g_local_test_logging_file_path = os.path.join(report_dir_path, logging_name)
    
    global g_local_logcat_log_file_path
    logcat_log_file_name = 'LogcatLogByTag.log'
    g_local_logcat_log_file_path = os.path.join(report_dir_path, logcat_log_file_name)
Ejemplo n.º 3
0
def send_reuqest_and_write_response():
    city_ids = g_city_ids
    url = 'http://apis.baidu.com/apistore/weatherservice/recentweathers'
    header_parms = {'apikey': '7705cca8df9fb3dbe696ce2310979a62'}

    file_name = 'baidu_weather_data_update_freq_src_%s.log' % g_cur_date
    file_path = os.path.join(g_log_dir, file_name)

    output_lines = []
    for id in city_ids:
        resp = None
        try:
            resp = HttpJsonUtils.send_get_request_with_header_and_return(
                url, header_parms, {'cityid': id})
        except Exception, e:
            logging.error('Exception: %s' % e)

        if resp is None:
            return
        line = '%s: %s\n' % (WinSysUtils.get_current_date_and_time(),
                             resp.decode('unicode_escape'))
        output_lines.append(line)
Ejemplo n.º 4
0
1) Run test cases and dump execution logs.
2) Start and dump logcat log.
3) Pull run listener results files and snapshots.
4) Generate html testing report.
'''

import os
import time
import subprocess

from ZJPyUtils import AdbUtils, WinSysUtils

# ----------------------------------------------------
# Constants
# ----------------------------------------------------
CUR_DATE_TIME = WinSysUtils.get_current_date_and_time()
REPORT_DIR_NAME = 'logs_inst_test_%s' % CUR_DATE_TIME
REPORT_DIR_PATH = os.path.join(os.getcwd(), 'logs', REPORT_DIR_NAME)
LOGCAT_FILE_NAME = 'logcat_log.txt'
LOGCAT_FILE_PATH = os.path.join(REPORT_DIR_PATH, LOGCAT_FILE_NAME)
INST_TEST_LOG_FILE_NAME = 'instrument_test_log.txt'
INST_TEST_LOG_FILE_PATH = os.path.join(REPORT_DIR_PATH, INST_TEST_LOG_FILE_NAME)

SHELL_TEST_LOG_DIR_PATH = '/sdcard/auto_test_logs/'
SHELL_SNAPSHOTS_DIR_PATH = SHELL_TEST_LOG_DIR_PATH + '.snapshots'
SHELL_SNAPSHOTS_DIR_NEW_PATH = SHELL_TEST_LOG_DIR_PATH + 'snapshots'

DATA_DIR_PATH = os.path.join(os.getcwd(), 'data')
JAR_FILE_PATH = os.path.join(DATA_DIR_PATH, 'XmlTransform.jar')
XSLT_FILE_PATH = os.path.join(DATA_DIR_PATH, 'testsuites.xstl')
Ejemplo n.º 5
0
1) Run test cases and dump execution logs.
2) Start and dump logcat log.
3) Pull run listener results files and snapshots.
4) Generate html testing report.
'''

import os
import time
import subprocess

from ZJPyUtils import AdbUtils, WinSysUtils

# ----------------------------------------------------
# Constants
# ----------------------------------------------------
CUR_DATE_TIME = WinSysUtils.get_current_date_and_time()
REPORT_DIR_NAME = 'logs_inst_test_%s' % CUR_DATE_TIME
REPORT_DIR_PATH = os.path.join(os.getcwd(), 'logs', REPORT_DIR_NAME)
LOGCAT_FILE_NAME = 'logcat_log.txt'
LOGCAT_FILE_PATH = os.path.join(REPORT_DIR_PATH, LOGCAT_FILE_NAME)
INST_TEST_LOG_FILE_NAME = 'instrument_test_log.txt'
INST_TEST_LOG_FILE_PATH = os.path.join(REPORT_DIR_PATH,
                                       INST_TEST_LOG_FILE_NAME)

SHELL_TEST_LOG_DIR_PATH = '/sdcard/auto_test_logs/'
SHELL_SNAPSHOTS_DIR_PATH = SHELL_TEST_LOG_DIR_PATH + '.snapshots'
SHELL_SNAPSHOTS_DIR_NEW_PATH = SHELL_TEST_LOG_DIR_PATH + 'snapshots'

DATA_DIR_PATH = os.path.join(os.getcwd(), 'data')
JAR_FILE_PATH = os.path.join(DATA_DIR_PATH, 'XmlTransform.jar')
XSLT_FILE_PATH = os.path.join(DATA_DIR_PATH, 'testsuites.xstl')