Commit c45a0d1f481bb864dbad9e74586d501ece265384
1 parent
f4b3695a
1
Showing
2 changed files
with
9 additions
and
17 deletions
testcase/hg/createTradingOrder/test_createTradingOrder.py
@@ -6,32 +6,23 @@ sys.path.extend(['/usr/jenkins/workspace/辅助脚本-创建交易单simple']) | @@ -6,32 +6,23 @@ sys.path.extend(['/usr/jenkins/workspace/辅助脚本-创建交易单simple']) | ||
6 | import commons as com | 6 | import commons as com |
7 | from commons.MySession import hg | 7 | from commons.MySession import hg |
8 | from commons.basic.createAndTrade import createAndTrade | 8 | from commons.basic.createAndTrade import createAndTrade |
9 | -from tmp import d | 9 | +from tmp import d,t |
10 | create = createAndTrade() | 10 | create = createAndTrade() |
11 | # path = os.path.dirname(os.path.abspath(sys.argv[0])) | 11 | # path = os.path.dirname(os.path.abspath(sys.argv[0])) |
12 | #查看文件有效路径 | 12 | #查看文件有效路径 |
13 | # print(sys.path) | 13 | # print(sys.path) |
14 | 14 | ||
15 | +# print(type(d),type(t)) | ||
15 | print("\n开始运行订单创建脚本...\n") | 16 | print("\n开始运行订单创建脚本...\n") |
16 | 17 | ||
17 | 18 | ||
18 | -#打印第三方请求json | ||
19 | -print(d) | 19 | +#打印第三方请求json市场和请求次数 |
20 | +print("请求参数={} 请求次数={}".format(d,t)) | ||
20 | 21 | ||
21 | -#获取命令行参数,市场和请求次数 | ||
22 | -cmd_list=sys.argv[1:] | ||
23 | -print(cmd_list) | ||
24 | 22 | ||
25 | -if len(cmd_list)!=0: | ||
26 | - for i in range(len(cmd_list)): | ||
27 | - print("参数值",i,cmd_list[i]) | ||
28 | - # print("测试市场{}".format(cmd_list[0])) | ||
29 | - # print("请求body{}".format(cmd_list[1])) | ||
30 | - # print("请求次数{}".format(cmd_list[2])) | ||
31 | - | ||
32 | - | ||
33 | -if d!="None" and len(cmd_list)!=0: | ||
34 | - for i in range(int(cmd_list[1])): | 23 | +#根据用户参数进行请求 |
24 | +if d!=None : | ||
25 | + for i in range(t): | ||
35 | body = d | 26 | body = d |
36 | print("创建订单,第{}次请求,请求body={}".format(i+1,body)) | 27 | print("创建订单,第{}次请求,请求body={}".format(i+1,body)) |
37 | re = hg.post(url = create.url, headers = create.header, json = body) | 28 | re = hg.post(url = create.url, headers = create.header, json = body) |