更新所有压测脚本,实现项目中运行和单独运行都可启动脚本
修复单独运行脚本时路径错误问题
14 files modified
24 files deleted
| | |
| | | """ |
| | | import sys |
| | | import os |
| | | # 将上一级目录加入模块搜索路径 |
| | | sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
| | | def get_parent_directory(file_path, levels=1): |
| | | """获取指定层级的父目录""" |
| | | path = os.path.abspath(file_path) |
| | | for _ in range(levels): |
| | | path = os.path.dirname(path) |
| | | return path |
| | | parent_dir = get_parent_directory(__file__, 5) # 获取上五级目录 |
| | | sys.path.append(parent_dir) |
| | | import asyncio |
| | | import aiohttp |
| | | import time |
| | | import traceback |
| | | import datetime |
| | | from tqdm import tqdm |
| | | from Util.random_util import RandomUtil |
| | | from Util.dingtalk_helper import DingTalkHelper |
| | | from 测试组.脚本.造数脚本2.Util.random_util import RandomUtil |
| | | from 测试组.脚本.造数脚本2.Util.dingtalk_helper import DingTalkHelper |
| | | import pymysql |
| | | import random |
| | | |
| | |
| | | } |
| | | |
| | | NUM_WORKERS = 100 |
| | | TOTAL_REQUESTS = 10000 |
| | | TOTAL_REQUESTS = 1 |
| | | MAX_RETRIES = 3 |
| | | REQUEST_TIMEOUT = 60 |
| | | OUTPUT_DIR = './load_test_report' |
| | |
| | | try: |
| | | import importlib.util |
| | | script_dir = os.path.dirname(os.path.abspath(__file__)) |
| | | report_path = os.path.join(script_dir, 'H:\\项目\\造数脚本\\Util\\stress_test_report_generator.py') |
| | | report_path = os.path.join(script_dir, 'H:\\项目\\archive\\测试组\\脚本\\造数脚本2\\Util\\stress_test_report_generator.py') |
| | | if os.path.exists(report_path): |
| | | spec = importlib.util.spec_from_file_location('report_module', report_path) |
| | | report_module = importlib.util.module_from_spec(spec) |
| | |
| | | """ |
| | | import sys |
| | | import os |
| | | # 将上一级目录加入模块搜索路径 |
| | | sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
| | | import asyncio |
| | | import aiohttp |
| | | import time |
| | | import traceback |
| | | import datetime |
| | | from tqdm import tqdm |
| | | from Util.random_util import RandomUtil |
| | | from Util.dingtalk_helper import DingTalkHelper |
| | | |
| | | def get_parent_directory(file_path, levels=1): |
| | | """获取指定层级的父目录""" |
| | | path = os.path.abspath(file_path) |
| | | for _ in range(levels): |
| | | path = os.path.dirname(path) |
| | | return path |
| | | 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 |
| | | |
| | | |
| | | # --- 配置 --- |
| | |
| | | try: |
| | | import importlib.util |
| | | script_dir = os.path.dirname(os.path.abspath(__file__)) |
| | | report_path = os.path.join(script_dir, 'H:\\项目\\造数脚本\\Util\\stress_test_report_generator.py') |
| | | report_path = os.path.join(script_dir, 'H:\\项目\\archive\\测试组\\脚本\\造数脚本2\\Util\\stress_test_report_generator.py') |
| | | if os.path.exists(report_path): |
| | | spec = importlib.util.spec_from_file_location('report_module', report_path) |
| | | report_module = importlib.util.module_from_spec(spec) |
| | |
| | | """ |
| | | import sys |
| | | import os |
| | | # 将上一级目录加入模块搜索路径 |
| | | sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
| | | import asyncio |
| | | import aiohttp |
| | | import time |
| | | import traceback |
| | | import datetime |
| | | from tqdm import tqdm |
| | | from Util.random_util import RandomUtil |
| | | from Util.dingtalk_helper import DingTalkHelper |
| | | import pymysql |
| | | import random |
| | | |
| | | def get_parent_directory(file_path, levels=1): |
| | | """获取指定层级的父目录""" |
| | | path = os.path.abspath(file_path) |
| | | for _ in range(levels): |
| | | path = os.path.dirname(path) |
| | | return path |
| | | 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 |
| | | |
| | | |
| | | |
| | | # --- 配置 --- |
| | |
| | | try: |
| | | import importlib.util |
| | | script_dir = os.path.dirname(os.path.abspath(__file__)) |
| | | report_path = os.path.join(script_dir, 'H:\\项目\\造数脚本\\Util\\stress_test_report_generator.py') |
| | | report_path = os.path.join(script_dir, 'H:\\项目\\archive\\测试组\\脚本\\造数脚本2\\Util\\stress_test_report_generator.py') |
| | | if os.path.exists(report_path): |
| | | spec = importlib.util.spec_from_file_location('report_module', report_path) |
| | | report_module = importlib.util.module_from_spec(spec) |
| | |
| | | import os |
| | | import random |
| | | import pymysql |
| | | # 将上一级目录加入模块搜索路径 |
| | | sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
| | | import asyncio |
| | | import aiohttp |
| | | import time |
| | | import traceback |
| | | import datetime |
| | | from tqdm import tqdm |
| | | from Util.random_util import RandomUtil |
| | | from Util.dingtalk_helper import DingTalkHelper |
| | | |
| | | def get_parent_directory(file_path, levels=1): |
| | | """获取指定层级的父目录""" |
| | | path = os.path.abspath(file_path) |
| | | for _ in range(levels): |
| | | path = os.path.dirname(path) |
| | | return path |
| | | 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 |
| | | |
| | | |
| | | # --- 配置 --- |
| | |
| | | try: |
| | | import importlib.util |
| | | script_dir = os.path.dirname(os.path.abspath(__file__)) |
| | | report_path = os.path.join(script_dir, r'H:\项目\造数脚本\Util\stress_test_report_generator.py') |
| | | report_path = os.path.join(script_dir, r'H:\\项目\\archive\\测试组\\脚本\\造数脚本2\\Util\\stress_test_report_generator.py') |
| | | if os.path.exists(report_path): |
| | | spec = importlib.util.spec_from_file_location('report_module', report_path) |
| | | report_module = importlib.util.module_from_spec(spec) |
| | |
| | | """ |
| | | import sys |
| | | import os |
| | | # 将上一级目录加入模块搜索路径 |
| | | sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
| | | import asyncio |
| | | import aiohttp |
| | | import time |
| | | import traceback |
| | | import datetime |
| | | from tqdm import tqdm |
| | | from Util.random_util import RandomUtil |
| | | from Util.dingtalk_helper import DingTalkHelper |
| | | |
| | | def get_parent_directory(file_path, levels=1): |
| | | """获取指定层级的父目录""" |
| | | path = os.path.abspath(file_path) |
| | | for _ in range(levels): |
| | | path = os.path.dirname(path) |
| | | return path |
| | | 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 |
| | | |
| | | |
| | | # --- 配置 --- |
| | |
| | | try: |
| | | import importlib.util |
| | | script_dir = os.path.dirname(os.path.abspath(__file__)) |
| | | report_path = os.path.join(script_dir, 'H:\\项目\\造数脚本\\Util\\stress_test_report_generator.py') |
| | | report_path = os.path.join(script_dir, 'H:\\项目\\archive\\测试组\\脚本\\造数脚本2\\Util\\stress_test_report_generator.py') |
| | | if os.path.exists(report_path): |
| | | spec = importlib.util.spec_from_file_location('report_module', report_path) |
| | | report_module = importlib.util.module_from_spec(spec) |
| | |
| | | """ |
| | | import sys |
| | | import os |
| | | # 将上一级目录加入模块搜索路径 |
| | | sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
| | | import asyncio |
| | | import aiohttp |
| | | import time |
| | | import traceback |
| | | import datetime |
| | | from tqdm import tqdm |
| | | from Util.random_util import RandomUtil |
| | | from Util.dingtalk_helper import DingTalkHelper |
| | | |
| | | def get_parent_directory(file_path, levels=1): |
| | | """获取指定层级的父目录""" |
| | | path = os.path.abspath(file_path) |
| | | for _ in range(levels): |
| | | path = os.path.dirname(path) |
| | | return path |
| | | |
| | | 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 |
| | | |
| | | |
| | | # --- 配置 --- |
| | |
| | | |
| | | # --- 初始化 --- |
| | | dingtalk_helper = DingTalkHelper(ACCESS_TOKEN, SECRET) |
| | | |
| | | # LARGE_CONTENT = "备注压测中" * 10 |
| | | # FILES_PATH = "/userfiles/1463828311460319233/程序附件//baoyi/individual/individualrecord/2025/10/cs.jpg" |
| | | |
| | | |
| | | def create_animal_data(idx: int): |
| | |
| | | try: |
| | | import importlib.util |
| | | script_dir = os.path.dirname(os.path.abspath(__file__)) |
| | | report_path = os.path.join(script_dir, 'H:\\项目\\造数脚本\\Util\\stress_test_report_generator.py') |
| | | report_path = os.path.join(script_dir, 'H:\\项目\\archive\\测试组\\脚本\\造数脚本2\\Util\\stress_test_report_generator.py') |
| | | if os.path.exists(report_path): |
| | | spec = importlib.util.spec_from_file_location('report_module', report_path) |
| | | report_module = importlib.util.module_from_spec(spec) |
| | |
| | | """ |
| | | import sys |
| | | import os |
| | | # 将上一级目录加入模块搜索路径 |
| | | sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
| | | import asyncio |
| | | import aiohttp |
| | | import time |
| | | import traceback |
| | | import datetime |
| | | from tqdm import tqdm |
| | | from Util.random_util import RandomUtil |
| | | from Util.dingtalk_helper import DingTalkHelper |
| | | |
| | | def get_parent_directory(file_path, levels=1): |
| | | """获取指定层级的父目录""" |
| | | path = os.path.abspath(file_path) |
| | | for _ in range(levels): |
| | | path = os.path.dirname(path) |
| | | return path |
| | | |
| | | 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 |
| | | |
| | | |
| | | # --- 配置 --- |
| | |
| | | try: |
| | | import importlib.util |
| | | script_dir = os.path.dirname(os.path.abspath(__file__)) |
| | | report_path = os.path.join(script_dir, 'H:\\项目\\造数脚本\\Util\\stress_test_report_generator.py') |
| | | report_path = os.path.join(script_dir, 'H:\\项目\\archive\\测试组\\脚本\\造数脚本2\\Util\\stress_test_report_generator.py') |
| | | if os.path.exists(report_path): |
| | | spec = importlib.util.spec_from_file_location('report_module', report_path) |
| | | report_module = importlib.util.module_from_spec(spec) |
| | |
| | | """ |
| | | import sys |
| | | import os |
| | | # 将上一级目录加入模块搜索路径 |
| | | sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
| | | import asyncio |
| | | import aiohttp |
| | | import time |
| | | import traceback |
| | | import datetime |
| | | from tqdm import tqdm |
| | | from Util.random_util import RandomUtil |
| | | from Util.dingtalk_helper import DingTalkHelper |
| | | |
| | | def get_parent_directory(file_path, levels=1): |
| | | """获取指定层级的父目录""" |
| | | path = os.path.abspath(file_path) |
| | | for _ in range(levels): |
| | | path = os.path.dirname(path) |
| | | return path |
| | | |
| | | 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 |
| | | |
| | | |
| | | # --- 配置 --- |
| | |
| | | try: |
| | | import importlib.util |
| | | script_dir = os.path.dirname(os.path.abspath(__file__)) |
| | | report_path = os.path.join(script_dir, 'H:\\项目\\造数脚本\\Util\\stress_test_report_generator.py') |
| | | report_path = os.path.join(script_dir, 'H:\\项目\\archive\\测试组\\脚本\\造数脚本2\\Util\\stress_test_report_generator.py') |
| | | if os.path.exists(report_path): |
| | | spec = importlib.util.spec_from_file_location('report_module', report_path) |
| | | report_module = importlib.util.module_from_spec(spec) |
| | |
| | | import sys |
| | | import os |
| | | import asyncio |
| | | import aiohttp |
| | | import traceback |
| | | import time |
| | | from Util.random_util import RandomUtil # 保证该模块中提供了生成随机数字和随机日期的函数 |
| | | from Util.dingtalk_helper import DingTalkHelper |
| | | from tqdm import tqdm # 导入进度条库 |
| | | import time |
| | | |
| | | def get_parent_directory(file_path, levels=1): |
| | | """获取指定层级的父目录""" |
| | | path = os.path.abspath(file_path) |
| | | for _ in range(levels): |
| | | path = os.path.dirname(path) |
| | | return path |
| | | 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 |
| | | |
| | | |
| | | # 钉钉机器人 access_token 和 secret |
| | | ACCESS_TOKEN = '4625f6690acd9347fae5b3a05af598be63e73d604b933a9b3902425b8f136d4d' |
| | |
| | | import sys |
| | | import os |
| | | import asyncio |
| | | import aiohttp |
| | | import traceback |
| | | import time |
| | | from Util.random_util import RandomUtil # 你已有的工具 |
| | | from Util.dingtalk_helper import DingTalkHelper |
| | | from tqdm import tqdm |
| | | import logging |
| | | |
| | | def get_parent_directory(file_path, levels=1): |
| | | """获取指定层级的父目录""" |
| | | path = os.path.abspath(file_path) |
| | | for _ in range(levels): |
| | | path = os.path.dirname(path) |
| | | return path |
| | | 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 |
| | | |
| | | |
| | | # 钉钉机器人 access_token 和 secret |
| | | ACCESS_TOKEN = '4625f6690acd9347fae5b3a05af598be63e73d604b933a9b3902425b8f136d4d' |
| | | SECRET = 'SEC3b6937550bd297b5491855f6f40c2ff1b41bc8c495e118ba9848742b1ddf8f19' |
| | |
| | | """ |
| | | import sys |
| | | import os |
| | | # 将上一级目录加入模块搜索路径 |
| | | sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
| | | import asyncio |
| | | import aiohttp |
| | | import time |
| | | import traceback |
| | | import datetime |
| | | from tqdm import tqdm |
| | | from Util.random_util import RandomUtil |
| | | from Util.dingtalk_helper import DingTalkHelper |
| | | |
| | | def get_parent_directory(file_path, levels=1): |
| | | """获取指定层级的父目录""" |
| | | path = os.path.abspath(file_path) |
| | | for _ in range(levels): |
| | | path = os.path.dirname(path) |
| | | return path |
| | | 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 |
| | | |
| | | |
| | | # --- 配置 --- |
| | |
| | | try: |
| | | import importlib.util |
| | | script_dir = os.path.dirname(os.path.abspath(__file__)) |
| | | report_path = os.path.join(script_dir, 'H:\\项目\\造数脚本\\Util\\stress_test_report_generator.py') |
| | | report_path = os.path.join(script_dir, 'H:\\项目\\archive\\测试组\\脚本\\造数脚本2\\Util\\stress_test_report_generator.py') |
| | | if os.path.exists(report_path): |
| | | spec = importlib.util.spec_from_file_location('report_module', report_path) |
| | | report_module = importlib.util.module_from_spec(spec) |
| | |
| | | """ |
| | | import sys |
| | | import os |
| | | # 将上一级目录加入模块搜索路径 |
| | | sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
| | | import asyncio |
| | | import aiohttp |
| | | import time |
| | | import traceback |
| | | import datetime |
| | | from tqdm import tqdm |
| | | from Util.random_util import RandomUtil |
| | | from Util.dingtalk_helper import DingTalkHelper |
| | | |
| | | def get_parent_directory(file_path, levels=1): |
| | | """获取指定层级的父目录""" |
| | | path = os.path.abspath(file_path) |
| | | for _ in range(levels): |
| | | path = os.path.dirname(path) |
| | | return path |
| | | 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 |
| | | |
| | | |
| | | # --- 配置 --- |
| | |
| | | try: |
| | | import importlib.util |
| | | script_dir = os.path.dirname(os.path.abspath(__file__)) |
| | | report_path = os.path.join(script_dir, 'H:\\项目\\造数脚本\\Util\\stress_test_report_generator.py') |
| | | report_path = os.path.join(script_dir, 'H:\\项目\\archive\\测试组\\脚本\\造数脚本2\\Util\\stress_test_report_generator.py') |
| | | if os.path.exists(report_path): |
| | | spec = importlib.util.spec_from_file_location('report_module', report_path) |
| | | report_module = importlib.util.module_from_spec(spec) |
| | |
| | | import sys |
| | | import os |
| | | import asyncio |
| | | import aiohttp |
| | | import traceback |
| | | import time |
| | | from Util.random_util import RandomUtil # 保证该模块中提供了生成随机数字和随机日期的函数 |
| | | from Util.dingtalk_helper import DingTalkHelper |
| | | from tqdm import tqdm # 导入进度条库 |
| | | import time |
| | | |
| | | def get_parent_directory(file_path, levels=1): |
| | | """获取指定层级的父目录""" |
| | | path = os.path.abspath(file_path) |
| | | for _ in range(levels): |
| | | path = os.path.dirname(path) |
| | | return path |
| | | 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 |
| | | |
| | | |
| | | # 钉钉机器人 access_token 和 secret |
| | | ACCESS_TOKEN = '4625f6690acd9347fae5b3a05af598be63e73d604b933a9b3902425b8f136d4d' |
| | |
| | | import sys |
| | | import os |
| | | # 将上一级目录加入模块搜索路径 |
| | | sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
| | | import asyncio |
| | | import aiohttp |
| | | import time |
| | |
| | | import pymysql |
| | | import random |
| | | from tqdm import tqdm |
| | | from Util.dingtalk_helper import DingTalkHelper |
| | | |
| | | # 将上一级目录加入模块搜索路径 |
| | | sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
| | | def get_parent_directory(file_path, levels=1): |
| | | """获取指定层级的父目录""" |
| | | path = os.path.abspath(file_path) |
| | | for _ in range(levels): |
| | | path = os.path.dirname(path) |
| | | return path |
| | | parent_dir = get_parent_directory(__file__, 5) # 获取上五级目录 |
| | | sys.path.append(parent_dir) |
| | | |
| | | from 测试组.脚本.造数脚本2.Util.dingtalk_helper import DingTalkHelper |
| | | |
| | | # --- 配置 --- |
| | | ACCESS_TOKEN = '4625f6690acd9347fae5b3a05af598be63e73d604b933a9b3902425b8f136d4d' |
| | |
| | | import importlib.util |
| | | |
| | | # 使用您提供的绝对路径 |
| | | report_path = 'H:\\项目\\造数脚本\\Util\\stress_test_report_generator.py' |
| | | report_path = 'H:\\项目\\archive\\测试组\\脚本\\造数脚本2\\Util\\stress_test_report_generator.py' |
| | | |
| | | if os.path.exists(report_path): |
| | | spec = importlib.util.spec_from_file_location('report_module', report_path) |