import os
from time import strftime
#jmeter_bin目录
jmeter_bin = r'D:\apache\apache-jmeter-4.0\bin'
#需要运行的jmeter脚本
jmeter_script = r"D:\api_project\token.jmx"
#测试报告存放路径
result = r'D:\api_project\report'
now = strftime('%Y_%m_%d_%H_%M_%S')
log_path = result + '\\' + now + "\\log"
report_path = result+'\\' + now + "\\report"
os.system("mkdir " +log_path)
os.system("mkdir " +report_path)
command = "jmeter -n -t %s -l %s\\jmeter.log -e -o %s"%(jmeter_script,log_path,report_path)
os.chdir(jmeter_bin)
os.system(command)