| | |
| | | import datetime |
| | | from tqdm import tqdm |
| | | import pymysql |
| | | import pymysql.cursors |
| | | import random |
| | | |
| | | def get_parent_directory(file_path, levels=1): |
| | |
| | | parent_dir = get_parent_directory(__file__, 5) # 获取上五级目录 |
| | | sys.path.append(parent_dir) |
| | | |
| | | from 测试组.脚本.造数脚本2.Util.random_util import RandomUtil |
| | | from 测试组.脚本.造数脚本2.Util.dingtalk_helper import DingTalkHelper |
| | | from 测试组.脚本.造数脚本2.Util import TokenValidator, DingTalkHelper, RandomUtil, RequestRecord, LoadTestReportGenerator |
| | | |
| | | |
| | | |
| | |
| | | 'cursorclass': pymysql.cursors.DictCursor |
| | | } |
| | | |
| | | # 账号密码配置 |
| | | username = "gly" |
| | | password = "Baoyi@1341" |
| | | # 创建获取token实例 |
| | | token_validator = TokenValidator() |
| | | |
| | | domain = "http://192.168.6.190:5561" |
| | | token = token_validator.get_token(domain, username, password) |
| | | |
| | | apiname = "笼位标记" |
| | | url = "http://192.168.6.190:5561/api/base/cage/cage/tagCage" |
| | | url = f"{domain}/api/base/cage/cage/tagCage" |
| | | headers = { |
| | | "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE3Njc5NTE3ODksInVzZXJuYW1lIjoiZ2x5In0.Btsm0AAxyyCID0ctiMFg95Wgb-KFdQJ1Lt0Va8dZpqI", |
| | | "token": token, |
| | | "Content-Type": "application/json" |
| | | } |
| | | |
| | | NUM_WORKERS = 200 |
| | | TOTAL_REQUESTS = 500000 |
| | | TOTAL_REQUESTS = 2 |
| | | MAX_RETRIES = 3 |
| | | REQUEST_TIMEOUT = 60 |
| | | OUTPUT_DIR = './load_test_report' |