Exemplo n.º 1
0
CASE_PATH = os.path.join(BASE_PATH, 'cases')

LOG_PATH = os.path.join(BASE_PATH, 'logs', 'atp.log')

REPORT_PATH = os.path.join(BASE_PATH, 'report')

f = faker.Faker(locale='zh-CN')

ENV = 'test'  #默认使用测试环境

host_map = {
    "test": "http://api.nnzhp.cn",
    "dev": "http://118.24.3.40:81/",
    "pre": "http://api.nnzhp.cn/",
}

HOST = host_map.get(ENV)

func_map = {
    "<phone>": f.phone_number,
    "<id_card>": f.ssn,
    "<email>": f.email,
    "<name>": f.name,
    "<addr>": f.address,
    "<password>": random_password
}  #这个是支持的参数化,如果要加其他的参数化,在这里继续加就行了。

log = nnlog.Logger(LOG_PATH)  #

CASE_FILE_START = 'test'  #这个找用例的规则,以什么开头就运行
Exemplo n.º 2
0
import nnlog
from app.config.globalparameter import LOG_PATH, LOG_LEVEL
atp_log = nnlog.Logger(LOG_PATH, level=LOG_LEVEL)
Exemplo n.º 3
0
 def write_log(cls, content):
     log = nnlog.Logger(cls.log_file_name)
     log.debug(content)
Exemplo n.º 4
0
import os
import nnlog
mysql_info = {
    'host': '118.24.3.40',
    'port': 3306,
    'user': '******',
    'password': '******',
    'db': 'litemall',
    'charset': 'utf8',
}

email_info = {'host': 'lsmtp.sf-express.com', 'user': '******', 'password': '******'}

email_to = ['***']
email_cc = ['***']

base_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
log_path = os.path.join(base_path, 'logs', 'utp.log')

log = nnlog.Logger(log_path)

email_template = '''
各位好:
    本次接口测试结果如下:总共运行【{all_count}】条用例,通过【{pass_count}】条,失败【{fail_count}】条。
    详细信息请查看附件。
'''
Exemplo n.º 5
0
import nnlog
from conf import setting
atp_log = nnlog.Logger(setting.LOG_PATH, level=setting.LOG_LEVEL)
Exemplo n.º 6
0
import nnlog

log = nnlog.Logger('test.log', level='debug', backCount=5)
log.debug('debug级别')
log.debug("test")
#debug
#info
#waring
#error
Exemplo n.º 7
0
'''
日志的级别常见的:
    error
    waning
    info
    debug
'''
import logging
import nnlog
log = nnlog.Logger('my.log',level='info',backCount=3,when='S')
#参数说明:
#指定生成的文件名称 必传
#level:默认debug级别,也可以指定其它级别
#backCount:保留日志的数量,backCountry=5 则日志最多保存3个文件,默认5
#when:按每小时、每分钟、每周产生日志,默认是D(天)
#
log.info('test 登录……')
log.error('登录失败!')
log.surprise()
print(dir(log))
Exemplo n.º 8
0
import os, nnlog, time
'''
配置路径
'''

BASE_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

LOG_PATH = os.path.join(BASE_PATH, 'logs')
REPORT_PATH = os.path.join(BASE_PATH, 'report/')
SNAPSHOT_PATH = os.path.join(BASE_PATH, 'snapshot/')
TEST_PATH = os.path.join(BASE_PATH, 'testCase/')
DATA_PATH = os.path.join(BASE_PATH, 'data')

nowtime = time.strftime('%Y%m%d %H%M%S')
RECORDER_PATH = os.path.join(BASE_PATH, 'recorder' + '/' + nowtime)
logname = os.path.join(LOG_PATH, 'log.txt')

CONFIG_PATH = os.path.join(BASE_PATH, 'config')

log = nnlog.Logger(file_name=logname, level='debug', when='D')
Exemplo n.º 9
0
 def __init__(self):
     self.pyse = Pyse('chrome')
     self.pyse.max_window()
     self.log = nnlog.Logger(file_name=CASELOG)