Commit 8f3f2bcf509529e47da5237265132203885a142d
Committed by
liujiqiang
1 parent
decaafb2
封装了接口的代码,更方便其他同事使用
Showing
16 changed files
with
174 additions
and
527 deletions
src/commons/MyRequest.py
... | ... | @@ -46,21 +46,45 @@ class myrequest(object): |
46 | 46 | log.info('响应body为{};'.format(res.json())) |
47 | 47 | return res |
48 | 48 | |
49 | - def put(self,url, data=None, **kwargs): | |
50 | - res = self.se.put(url, data=data, **kwargs) | |
51 | - return res | |
52 | - | |
53 | - def delete(self,url, **kwargs): | |
54 | - res = self.se.delete(url, **kwargs) | |
55 | - return res | |
56 | - | |
57 | - def patch(self,url, data=None, **kwargs): | |
58 | - res = self.se.patch(url,data=data, **kwargs) | |
59 | - return res | |
60 | - | |
61 | - def head(self, url, **kwargs): | |
62 | - res = self.se.patch(url,data=None, **kwargs) | |
63 | - return res | |
49 | + def post2(self,api,**kwargs): | |
50 | + self.api=api.split("_")[2] | |
51 | + self.api_num=(api.split("_")[2]+api.split("_")[1]) | |
52 | + self.method=com.get_api_config(self.api,self.api_num,'method') | |
53 | + self.body_format=com.get_api_config(self.api,self.api_num,'body_format') | |
54 | + self.url=com.get_api_config(self.api,self.api_num, 'url') | |
55 | + self.data=None if self.body_format=="JSON" else com.get_api_config(self.api,self.api_num,'body') | |
56 | + self.json=None if self.body_format=="FORM" else json.loads(com.get_api_config(self.api,self.api_num,'body')) | |
57 | + self.headers=json.loads(com.get_api_config(self.api,self.api_num,'header')) | |
58 | + log.info('{0:=^80}'.format('请求接口为{}'.format(api))) | |
59 | + log.info('请求地址为{}; 请求方式为{}; 请求body格式为{};\n 请求body为{}{};'.format( | |
60 | + self.url, | |
61 | + self.method, | |
62 | + self.body_format, | |
63 | + self.data, | |
64 | + self.json)) | |
65 | + | |
66 | + if self.method.upper()=="POST": | |
67 | + res = self.se.post(self.url, data=self.data, json=self.json,proxies=self.proxies,headers=self.headers,**kwargs) | |
68 | + log.info('响应body为{};'.format(res.json())) | |
69 | + return res | |
70 | + elif self.method.upper()=="GET": | |
71 | + res = self.se.GET(self.url,proxies=self.proxies,**kwargs) | |
72 | + log.info('响应body为{};'.format(res.json())) | |
73 | + return res | |
74 | + elif self.method.upper()=="PUT": | |
75 | + res = self.se.put(self.self.url, data=self.data, json=self.json,proxies=self.proxies,**kwargs) | |
76 | + log.info('响应body为{};'.format(res.json())) | |
77 | + return res | |
78 | + elif self.method.upper()=="DELETE": | |
79 | + res = self.se.delete(self.self.url,proxies=self.proxies,**kwargs) | |
80 | + log.info('响应body为{};'.format(res.json())) | |
81 | + return res | |
82 | + elif self.method.upper()=="HEAD": | |
83 | + res = self.se.head(self.url,proxies=self.proxies,**kwargs) | |
84 | + log.info('响应body为{};'.format(res.json())) | |
85 | + return res | |
86 | + else : | |
87 | + raise Exception("Request method error") | |
64 | 88 | |
65 | 89 | def close_session(self): |
66 | 90 | self.se.close() |
... | ... | @@ -86,7 +110,21 @@ class myrequest(object): |
86 | 110 | # # print("405 METHOD NOT ALLOWED") |
87 | 111 | # Logger.error("METHOD NOT ALLOWED".format(method)) |
88 | 112 | # return res |
89 | - | |
113 | +# | |
90 | 114 | # test=myrequest() |
115 | +# # 获取session | |
91 | 116 | # re=test.getSession(True) |
92 | -# print(re.headers) | |
93 | 117 | \ No newline at end of file |
118 | +# print(re.headers) | |
119 | +# # 请求 | |
120 | +# # re2=test.post(com.get_api_config('upStream', 'upStream01', 'url'), | |
121 | +# # json=json.loads(d), | |
122 | +# # headers=json.loads(com.get_api_config('upStream', 'upStream01', 'header'))) | |
123 | +# # print(re2.json()) | |
124 | +# | |
125 | +# d=com.get_api_config('upStream', 'upStream01', 'body') | |
126 | +# print(type(json.loads(d))) | |
127 | +# print(d) | |
128 | +# print(d.encode().decode('unicode-escape')) | |
129 | +# | |
130 | +# re3=test.post2("test_01_upStream",body="json") | |
131 | +# print(re3.json()) | ... | ... |
src/commons/__pycache__/MyRequest.cpython-36.pyc
No preview for this file type
src/commons/__pycache__/common.cpython-36.pyc
No preview for this file type
src/commons/common.py
... | ... | @@ -353,6 +353,10 @@ def post_request(api,caseNum,requestBody): |
353 | 353 | raise Exception(u"Request Fail! Response Code is not 200,Pls Check Your Request Datas") |
354 | 354 | |
355 | 355 | |
356 | + | |
357 | + | |
358 | +# def my | |
359 | + | |
356 | 360 | # a='https://gateway.fresh.nong12.com/getCityByPosition?lat=30.661286&lng=104.067624' |
357 | 361 | # b={ |
358 | 362 | # "Host": "gateway.fresh.nong12.com", | ... | ... |
src/config/api/arrivalUnderTakeOrder.conf deleted
100644 → 0
1 | -# -*- coding: UTF-8 -*- | |
2 | - | |
3 | -[arrivalUnderTakeOrder01] | |
4 | -url=http://oms.tms.nong12.com/transportOrder/arrivalUnderTakeOrder.action?code=UO20191202000003&arrivalNum=5&arrivalWeight=5.0&stevedore=卸货人&loadingPlaceId=10&arrivalTime=2019-12-02&attachments= | |
5 | - | |
6 | -body="" | |
7 | - | |
8 | -expect_response={"code":"200","message":"OK","result":"OK","success":true} | |
9 | - | |
10 | - |
src/config/api/customerOrderSubmit.conf deleted
100644 → 0
1 | -# -*- coding: UTF-8 -*- | |
2 | - | |
3 | -[customerOrderSubmit01] | |
4 | -url=http://oms.tms.nong12.com/undertakeDemandCenter/customerOrderSubmit.action | |
5 | - | |
6 | -update_header01={"Content-Type":"application/json;charset=UTF-8","Referer":"http://oms.tms.nong12.com/undertakeDemandCenter/orderSplit.html"} | |
7 | - | |
8 | - | |
9 | -body=[{"code":"CO20191126000037","splitMap":{"SC201905210001":5}},{"code":"CO20191126000037","splitMap":{"SC201905210001":5}}] | |
10 | - | |
11 | -expect_response={"code":"200","data":["UO20191202000001","UO20191202000002"],"message":"新增成功","result":"新增成功","success":true} | |
12 | - | |
13 | - |
src/config/api/departTransportOrder.conf deleted
100644 → 0
src/config/api/login.conf
1 | 1 | # -*- coding: UTF-8 -*- |
2 | 2 | |
3 | 3 | [login01] |
4 | -url=http://tms.nong12.com/login/login.action | |
4 | +method=post | |
5 | +url=http://test.uap.diligrp.com/login/login.action | |
5 | 6 | |
6 | -header={"Host":"tms.nong12.com", | |
7 | - "Connection":"keep-alive", | |
8 | - "Content-Length":"48", | |
9 | - "Cache-Control":"max-age=0", | |
10 | - "Origin":"http://tms.nong12.com", | |
11 | - "Upgrade-Insecure-Requests":"1", | |
12 | - "Content-Type":"application/json", | |
13 | - "User-Agent":"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3493.3 Safari/537.36", | |
14 | - "Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", | |
15 | - "Referer":"http://tms.nong12.com/login/login.action", | |
16 | - "Accept-Encoding":"gzip, deflate", | |
17 | - "Accept-Language":"zh-CN,zh-TW;q=0.9,zh;q=0.8", | |
18 | - "Cookie":"u=424; n=wenze; loginPath=http://tms.nong12.com/login/login.action; TMS_userId=69; TMS_username=wenze; TMS_SessionId="} | |
7 | +header={ | |
8 | + "Host": "test.uap.diligrp.com", | |
9 | + "Connection": "keep-alive", | |
10 | + "Content-Length": "33", | |
11 | + "Cache-Control": "max-age=0", | |
12 | + "Upgrade-Insecure-Requests": "1", | |
13 | + "Origin": "http://test.uap.diligrp.com", | |
14 | + "Content-Type": "application/x-www-form-urlencoded", | |
15 | + "User-Agent": "Mozilla/5.0(WindowsNT10.0;Win64;x64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/90.0.4430.212Safari/537.36", | |
16 | + "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", | |
17 | + "Referer": "http://test.uap.diligrp.com/login/index.html", | |
18 | + "Accept-Encoding": "gzip,deflate", | |
19 | + "Accept-Language": "zh-CN,zh-TW;q=0.9,zh;q=0.8,en;q=0.7", | |
20 | + "Cookie": "UAP_accessToken=;UAP_refreshToken=;UAP_loginPath="} | |
19 | 21 | |
20 | -body={"userName": "wenze", "password": "666666"} | |
22 | +body=userName=sg_wenze&password=111111 | |
21 | 23 | |
22 | 24 | |
23 | 25 | ... | ... |
src/config/api/saveOrUpdate.conf deleted
100644 → 0
1 | -# -*- coding: UTF-8 -*- | |
2 | - | |
3 | -[saveOrUpdate01] | |
4 | -url=http://oms.tms.nong12.com/customerOrder/saveOrUpdate.action | |
5 | - | |
6 | -update_header01={"X-Requested-With": "XMLHttpRequest","Content-Type":"application/x-www-form-urlencoded; charset=UTF-8","Origin":"http://tms.nong12.com","Referer":"http://oms.tms.nong12.com/customerOrder"} | |
7 | - | |
8 | -update_header02={"Accept": "application/json, text/javascript, */*; q=0.01","Host":"oms.tms.nong12.com","Connection":"keep-alive"} | |
9 | - | |
10 | -body={ | |
11 | - "customerCellphone": "18628307268", | |
12 | - "customerCode": "CUSO201907220001", | |
13 | - "customerName": "火影", | |
14 | - "transportWay": "test", | |
15 | - "demandSources": "webChatApp", | |
16 | - "amount": "", | |
17 | - "demandDescription": "经济", | |
18 | - "shippingCustomer": "火影", | |
19 | - "shippingContactName": "火影", | |
20 | - "shippingContactNumber": "18628307268", | |
21 | - "shipping_city": "拉萨", | |
22 | - "shippingCityId": "14", | |
23 | - "shippingAddress": "刚刚", | |
24 | - "requestedShipDate": "2019-08-15", | |
25 | - "shippingDesc": "", | |
26 | - "receiptCustomer": "水星", | |
27 | - "receiptContactName": "水星", | |
28 | - "receiptContactNumber": "13111555555", | |
29 | - "receipt_city": "成都", | |
30 | - "receiptCityId": "9", | |
31 | - "receiptAddress": "哦哦哦", | |
32 | - "tradeId": "", | |
33 | - "tradeCard": "", | |
34 | - "requestedReceiptDate": "2019-08-15", | |
35 | - "receiptDesc": "", | |
36 | - "productName1": "国光苹果", | |
37 | - "categoryId1": "312", | |
38 | - "specificationCode1": "SC201905210001", | |
39 | - "total1": "10", | |
40 | - "singleWeight1": "1.0", | |
41 | - "weight1": "10", | |
42 | - "transportCondition1": "ordinary", | |
43 | - "transportDesc1": "经济", | |
44 | - "goodsList[0][categoryId]": "312", | |
45 | - "goodsList[0][specificationCode]": "SC201905210001", | |
46 | - "goodsList[0][total]": "10", | |
47 | - "goodsList[0][singleWeight]": "1.0", | |
48 | - "goodsList[0][weight]": "10", | |
49 | - "goodsList[0][transportCondition]": "ordinary", | |
50 | - "goodsList[0][transportDesc]": "经济", | |
51 | - "goodsList[0][ruleId]": "82", | |
52 | - "firmCode": "CC201905200058", | |
53 | - "settlementMethod": "arrived", | |
54 | - "expense": "1000", | |
55 | - "expenseMap[r_82]": "1000"} | |
56 | - | |
57 | -expect_response={"code":"200","data":951,"message":"创建客户订单成功","result":"创建客户订单成功","success":true} | |
58 | - |
src/config/api/submitOrder.conf deleted
100644 → 0
1 | -# -*- coding: UTF-8 -*- | |
2 | - | |
3 | -[RequstURL] | |
4 | -URL=http://10.28.12.154:8085/submitOrder | |
5 | - | |
6 | -[RequstHeader] | |
7 | -header = { | |
8 | - "Host": "10.28.12.154:8085", | |
9 | - "Content-Type": "application/json", | |
10 | - "referer": "https://servicewechat.com/wxd1405e5c40ff05db/0/page-frame.html", | |
11 | - "apiusertoken": "dili-fresh-token", | |
12 | - "charset": "utf-8", | |
13 | - "Accept-Encoding": "gzip", | |
14 | - "User-Agent": "Mozilla/5.0 (Linux; Android 7.0; HUAWEI NXT-AL10 Build/HUAWEINXT-AL10; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/59.0.3071.125 Mobile Safari/537.36 MicroMessenger/6.7.3.1360(0x2607033D) NetType/WIFI Language/zh_CN Process/appbrand2" | |
15 | - } | |
16 | -headers=none | |
17 | -headers1={"id":"你好","name": "test"} | |
18 | -headers2=["id":"你好","name": "test"] | |
19 | - | |
20 | - | |
21 | - | |
22 | -[RequstStructrue] | |
23 | -structrue={ | |
24 | - "payCredential": "1548316340046", | |
25 | - "customerCode": "00010966", | |
26 | - "amount": 0, | |
27 | - "source": "wechatApplet", | |
28 | - "deliveryMethod": "homeDelivery", | |
29 | - "cityId": "510100", | |
30 | - "cityName": "成都市", | |
31 | - "shopCode": "S001953", | |
32 | - "shopName": "成都SAC新店0001","useFreeAmount": 0, | |
33 | - "items": [{ | |
34 | - "areaId": "510100", | |
35 | - "productId": 301, | |
36 | - "productCode": "PD2019011700000052", | |
37 | - "productName": "猕猴桃", | |
38 | - "price": 0, | |
39 | - "quantity": 1 | |
40 | - }] | |
41 | - } | |
42 | - | |
43 | -[basic_data_prepare] | |
44 | -#商品 | |
45 | -instert_product=INSERT INTO product.product VALUES ('301', '16', '猕猴桃', 'PD2019021000000001', '猕猴桃', 'dili-fresh/groupbuy/7f9fc034c2ec41e18b7560fc42a25abd', '2019-01-29 08:00:00', '2020-12-12 00:00:00', '2019-02-02 10:00:00', '2019-12-11 20:00:00', '600', '<p>预售商品,次日取货。</p><p>预计到店时间:2月3日14点之后。</p><p>到货后群内通知。</p><p><img style=\"max-width:100%;\" src=\"http://img10.nong12.com/dili-fresh/groupbuy/c4aa09d06af948f09269cd0d367fa623\"><br></p><p><br></p>', '2019-01-29 15:48:19', '1', '2019-02-02 10:13:33', '39', '4', '0', '400', '0'); | |
46 | -#商品 | |
47 | -instert_product_tag=INSERT INTO product.product_tag VALUES ('500', '1', '300', null, null, '2019-02-10 10:13:34', '2019-02-10 10:13:33'); | |
48 | -instert_tag=INSERT INTO `tag` VALUES ('1', '年货爆款', '26', '2019-01-14 11:24:48', '26', '2019-03-05 14:13:46', '27'); | |
49 | -instert_product_stock1=INSERT INTO product.area_stock VALUES ('500', '300', '600', '1000', '0', '1000', '1', '510100', '2019-02-02 10:13:33', '999', null, '2019-01-29 15:48:19', null, '6', '0', '3.00', '1000'); | |
50 | -instert_product_stock2=INSERT INTO product.area_stock VALUES ('501', '300', '600', '1000', '0', '1000', '1', '210100', '2019-02-02 16:40:49', '999', null, '2019-01-29 15:48:19', null, '78', '0', '3.00', '1000'); | |
51 | -instert_shop=INSERT INTO `shop` VALUES ('116', '成都SAC新店0001', 'S001953', 'W000101', '00010953', '四川省成都市青羊区天府广场', null, '510100', null, '30.663420320381004', '104.07219216758062', null, '李老板', '15111888983', null, null, '天府广场', '3', null, '1', '1', '2019-02-11 14:12:01', null, null, null); | |
52 | -instert_wallet=INSERT INTO `wallet` VALUES ('11845', '00010953', '0', '0', '0', '1', '0', '2019-02-11 12:08:50', '2019-02-11 12:08:50', null, null); | |
53 | - | |
54 | -[data_clean] | |
55 | -delete_product=DELETE FROM product.product WHERE id = 300; | |
56 | -delete_product_tag=DELETE FROM product.product_tag WHERE product_tag.product_id = 300; | |
57 | -delete_product_stock=DELETE FROM product.area_stock WHERE area_stock.product_id = 300; | |
58 | - | |
59 | - | |
60 | -[submitOrder01] | |
61 | -notes="下单成功:优惠券为空,其他参数传入有效值" | |
62 | -delete_order=DELETE FROM `customer_coupon` WHERE code = 10000; | |
63 | -requestBody={ | |
64 | - "payCredential": "1548316340046", | |
65 | - "customerCode": "00010966", | |
66 | - "amount": 0, | |
67 | - "source": "wechatApplet", | |
68 | - "deliveryMethod": "homeDelivery", | |
69 | - "cityId": "510100", | |
70 | - "cityName": "成都市", | |
71 | - "shopCode": "S001953", | |
72 | - "shopName": "成都SAC新店0001", | |
73 | - "useFreeAmount": 0, | |
74 | - "items": [{ | |
75 | - "areaId": "510100", | |
76 | - "productId": 301, | |
77 | - "productCode": "PD2019021100000001", | |
78 | - "productName": "猕猴桃", | |
79 | - "price": 0, | |
80 | - "quantity": 1 | |
81 | - }] | |
82 | - } | |
83 | -expect_Response={"code":"200","data":{"nonceStr":"APm6DY1wlK7cGkVbOAqe","orderCode":"O2019021400000009","pacKage":"prepay_id=1550137322575","payEnable":2,"paySign":"470D0E4BD0A2F13F8772DF29A6B7B206","signType":"MD5","timeStamp":"1550137323166"},"result":"OK","success":1} | |
84 | - | |
85 | - | |
86 | -[submitOrder02] | |
87 | -notes="下单失败:商品为空时,优惠券为空,其他参数填入有效值" | |
88 | -requestBody={ | |
89 | - "payCredential": "1548316340046", | |
90 | - "customerCode": "00010966", | |
91 | - "amount": 0, | |
92 | - "source": "wechatApplet", | |
93 | - "deliveryMethod": "homeDelivery", | |
94 | - "cityId": "510100", | |
95 | - "cityName": "成都市", | |
96 | - "shopCode": "S001953", | |
97 | - "shopName": "成都SAC新店0001", | |
98 | - "useFreeAmount": 0, | |
99 | - "items": [] | |
100 | - } | |
101 | -expect_Response={"code":"5000","result":"优惠券不可用","success":false} | |
102 | - | |
103 | -[submitOrder03] | |
104 | -notes="下单成功:使用有效优惠券,其他参数填入有效值" | |
105 | -coupon_check=SELECT * FROM customer.customer_coupon WHERE id = 10000; | |
106 | -coupon_insert=INSERT INTO `customer_coupon` VALUES ('10000', '1', '00010966', '004', '成勇测试01', 'auto', '2', '1', '1000', '0', '2019-01-17 00:00:00', '2025-01-26 23:59:59', '10', '2019-01-17 15:14:15', null, '1'); | |
107 | -coupon_delete=DELETE FROM `customer_coupon` WHERE id = 10000; | |
108 | -requestBody={ | |
109 | - "payCredential": "1548323014928", | |
110 | - "customerCode": "00010966", | |
111 | - "amount": 0, | |
112 | - "source": "wechatApplet", | |
113 | - "deliveryMethod": "homeDelivery", | |
114 | - "cityId": "510100", | |
115 | - "cityName": "成都市", | |
116 | - "shopCode": "S001953", | |
117 | - "shopName": "成都SAC新店0001", | |
118 | - "useFreeAmount": 0, | |
119 | - "items": [{ | |
120 | - "areaId": "510100", | |
121 | - "productId": 301, | |
122 | - "productCode": "PD2019011700000052", | |
123 | - "productName": "猕猴桃", | |
124 | - "price": 0, | |
125 | - "quantity": 1 | |
126 | - }], | |
127 | - "customerCouponId": 10000 | |
128 | - } | |
129 | -expect_Response={"code":"200","data":{"nonceStr":"APm6DY1wlK7cGkVbOAqe","orderCode":"O2019021400000009","pacKage":"prepay_id=1550137322575","payEnable":2,"paySign":"470D0E4BD0A2F13F8772DF29A6B7B206","signType":"MD5","timeStamp":"1550137323166"},"result":"OK","success":1} | |
130 | - | |
131 | - | |
132 | - | |
133 | -[submitOrder04] | |
134 | -notes="下单失败:支付用已经使用过的优惠券" | |
135 | -coupon_check=SELECT * FROM customer.customer_coupon WHERE id = 10000; | |
136 | -coupon_insert=INSERT INTO `customer_coupon` VALUES ('10000', '0', '00010953', '004', '成勇测试01', 'auto', '2', '1', '1000', '0', '2019-01-17 00:00:00', '2025-01-26 23:59:59', '10', '2019-01-17 15:14:15', null, '1'); | |
137 | -coupon_delete=DELETE FROM `customer_coupon` WHERE id = 10000; | |
138 | -requestBody={ | |
139 | - "payCredential": "1548323014928", | |
140 | - "customerCode": "00010966", | |
141 | - "amount": 0, | |
142 | - "source": "wechatApplet", | |
143 | - "deliveryMethod": "homeDelivery", | |
144 | - "cityId": "510100", | |
145 | - "cityName": "成都市", | |
146 | - "shopCode": "S001953", | |
147 | - "shopName": "成都SAC新店0001", | |
148 | - "useFreeAmount": 0, | |
149 | - "items": [{ | |
150 | - "areaId": "510100", | |
151 | - "productId": 301, | |
152 | - "productCode": "PD2019021100000001", | |
153 | - "productName": "猕猴桃", | |
154 | - "price": 0, | |
155 | - "quantity": 1 | |
156 | - }], | |
157 | - "customerCouponId": 10000 | |
158 | - } | |
159 | -expect_Response={"code":"5000","result":"优惠券不可用","success":false} | |
160 | - | |
161 | - | |
162 | -[submitOrder05] | |
163 | -notes="下单失败:支付用过期的优惠券" | |
164 | -coupon_check=SELECT * FROM customer.customer_coupon WHERE id = 10000; | |
165 | -coupon_insert=INSERT INTO `customer_coupon` VALUES ('10000', '1', '00010953', '004', '成勇测试01', 'auto', '2', '1', '1000', '0', '2019-01-17 00:00:00', '2019-01-18 23:59:59', '10', '2019-01-17 15:14:15', null, '1'); | |
166 | -coupon_delete=DELETE FROM `customer_coupon` WHERE id = 10000; | |
167 | -requestBody={ | |
168 | - "payCredential": "1548323014928", | |
169 | - "customerCode": "00010966", | |
170 | - "amount": 0, | |
171 | - "source": "wechatApplet", | |
172 | - "deliveryMethod": "homeDelivery", | |
173 | - "cityId": "510100", | |
174 | - "cityName": "成都市", | |
175 | - "shopCode": "S001953", | |
176 | - "shopName": "成都SAC新店0001", | |
177 | - "useFreeAmount": 0, | |
178 | - "items": [{ | |
179 | - "areaId": "510100", | |
180 | - "productId": 301, | |
181 | - "productCode": "PD2019021100000001", | |
182 | - "productName": "猕猴桃", | |
183 | - "price": 0, | |
184 | - "quantity": 1 | |
185 | - }], | |
186 | - "customerCouponId": 10000 | |
187 | - } | |
188 | -expect_Response={"code":"5000","result":"优惠券不可用","success":false} | |
189 | - | |
190 | -[submitOrder06] | |
191 | -notes="下单失败:支付用别人的优惠券" | |
192 | -coupon_check=SELECT * FROM customer.customer_coupon WHERE id = 10000; | |
193 | -coupon_insert=INSERT INTO `customer_coupon` VALUES ('10000', '1', '00001008', '004', '成勇测试01', 'auto', '2', '1', '1000', '0', '2019-01-17 00:00:00', '2025-01-18 23:59:59', '10', '2019-01-17 15:14:15', null, '1'); | |
194 | -coupon_delete=DELETE FROM `customer_coupon` WHERE id = 10000; | |
195 | -requestBody={ | |
196 | - "payCredential": "1548323014928", | |
197 | - "customerCode": "00010966", | |
198 | - "amount": 0, | |
199 | - "source": "wechatApplet", | |
200 | - "deliveryMethod": "homeDelivery", | |
201 | - "cityId": "510100", | |
202 | - "cityName": "成都市", | |
203 | - "shopCode": "S001953", | |
204 | - "shopName": "成都SAC新店0001", | |
205 | - "useFreeAmount": 0, | |
206 | - "items": [{ | |
207 | - "areaId": "510100", | |
208 | - "productId": 301, | |
209 | - "productCode": "PD2019021100000001", | |
210 | - "productName": "猕猴桃", | |
211 | - "price": 0, | |
212 | - "quantity": 1 | |
213 | - }], | |
214 | - "customerCouponId": 10000 | |
215 | - } | |
216 | -expect_Response={"code":"5000","result":"优惠券不可用","success":false} | |
217 | - | |
218 | - | |
219 | -[submitOrder07] | |
220 | -notes="下单失败:支付用未到期的优惠券" | |
221 | -coupon_check=SELECT * FROM customer.customer_coupon WHERE id = 10000; | |
222 | -coupon_insert=INSERT INTO `customer_coupon` VALUES ('10000', '1', '00010953', '004', '成勇测试01', 'auto', '2', '1', '1000', '0', '2025-01-17 00:00:00', '2025-01-18 23:59:59', '10', '2019-01-17 15:14:15', null, '1'); | |
223 | -coupon_delete=DELETE FROM `customer_coupon` WHERE id = 10000; | |
224 | -requestBody={ | |
225 | - "payCredential": "1548323014928", | |
226 | - "customerCode": "00010966", | |
227 | - "amount": 0, | |
228 | - "source": "wechatApplet", | |
229 | - "deliveryMethod": "homeDelivery", | |
230 | - "cityId": "510100", | |
231 | - "cityName": "成都市", | |
232 | - "shopCode": "S001953", | |
233 | - "shopName": "成都SAC新店0001", | |
234 | - "useFreeAmount": 0, | |
235 | - "items": [{ | |
236 | - "areaId": "510100", | |
237 | - "productId": 301, | |
238 | - "productCode": "PD2019021100000001", | |
239 | - "productName": "猕猴桃", | |
240 | - "price": 0, | |
241 | - "quantity": 1 | |
242 | - }], | |
243 | - "customerCouponId": 10000 | |
244 | - } | |
245 | -expect_Response={"code":"5000","result":"优惠券不可用","success":false} | |
246 | - | |
247 | -[submitOrder08] | |
248 | -notes="下单失败:支付用未满减条件的优惠券" | |
249 | -coupon_check=SELECT * FROM customer.customer_coupon WHERE id = 10000; | |
250 | -coupon_insert=INSERT INTO `customer_coupon` VALUES ('10000', '1', '00010953', '004', '成勇测试01', 'auto', '2', '1', '1000', '1000', '2019-01-17 00:00:00', '2025-01-18 23:59:59', '10', '2019-01-17 15:14:15', null, '1'); | |
251 | -coupon_delete=DELETE FROM `customer_coupon` WHERE id = 10000; | |
252 | -requestBody={ | |
253 | - "payCredential": "1548323014928", | |
254 | - "customerCode": "00010966", | |
255 | - "amount": 0, | |
256 | - "source": "wechatApplet", | |
257 | - "deliveryMethod": "homeDelivery", | |
258 | - "cityId": "510100", | |
259 | - "cityName": "成都市", | |
260 | - "shopCode": "S001953", | |
261 | - "shopName": "成都SAC新店0001", | |
262 | - "useFreeAmount": 0, | |
263 | - "items": [{ | |
264 | - "areaId": "510100", | |
265 | - "productId": 301, | |
266 | - "productCode": "PD2019021100000001", | |
267 | - "productName": "猕猴桃", | |
268 | - "price": 0, | |
269 | - "quantity": 1 | |
270 | - }], | |
271 | - "customerCouponId": 10000 | |
272 | - } | |
273 | -expect_Response={"code":"5000","result":"优惠券不可用","success":false} | |
274 | - | |
275 | -[submitOrder09] | |
276 | -notes="下单失败:使用被关闭的自提点" | |
277 | -shop_shutdown=UPDATE `fresh-uap`.shop SET state = 4 WHERE code = 'S001953' ; | |
278 | -shop_open=UPDATE `fresh-uap`.shop SET state = 3 WHERE code = 'S001953' ; | |
279 | -requestBody={ | |
280 | - "payCredential": "1548323014928", | |
281 | - "customerCode": "00010966", | |
282 | - "amount": 0, | |
283 | - "source": "wechatApplet", | |
284 | - "deliveryMethod": "homeDelivery", | |
285 | - "cityId": "510100", | |
286 | - "cityName": "成都市", | |
287 | - "shopCode": "S001953", | |
288 | - "shopName": "成都SAC新店0001", | |
289 | - "useFreeAmount": 0, | |
290 | - "items": [{ | |
291 | - "areaId": "510100", | |
292 | - "productId": 301, | |
293 | - "productCode": "PD2019021100000001", | |
294 | - "productName": "猕猴桃", | |
295 | - "price": 0, | |
296 | - "quantity": 1 | |
297 | - }] | |
298 | - } | |
299 | -expect_Response={"code":"5000","result":"自提点异常","success":false} | |
300 | - | |
301 | - | |
302 | -[submitOrder10] | |
303 | -notes="下单失败:客户被禁用时下单" | |
304 | -customer_disable=UPDATE customer.customer SET enabled_state = 0 WHERE `code` = 00010966 ; | |
305 | -customer_enable=UPDATE customer.customer SET enabled_state = 1 WHERE `code` = 00010966 ; | |
306 | -requestBody={ | |
307 | - "payCredential": "1548323014928", | |
308 | - "customerCode": "00010966", | |
309 | - "amount": 0, | |
310 | - "source": "wechatApplet", | |
311 | - "deliveryMethod": "homeDelivery", | |
312 | - "cityId": "510100", | |
313 | - "cityName": "成都市", | |
314 | - "shopCode": "S001953", | |
315 | - "shopName": "成都SAC新店0001", | |
316 | - "useFreeAmount": 0, | |
317 | - "items": [{ | |
318 | - "areaId": "510100", | |
319 | - "productId": 301, | |
320 | - "productCode": "PD2019021100000001", | |
321 | - "productName": "猕猴桃", | |
322 | - "price": 0, | |
323 | - "quantity": 1 | |
324 | - }] | |
325 | - } | |
326 | -expect_Response={"code":"5000","result":"账户被禁用","success":false} | |
327 | - | |
328 | -[submitOrder11] | |
329 | -notes="下单失败:购买其他地区的商品" | |
330 | -requestBody={ | |
331 | - "payCredential": "1548316340046", | |
332 | - "customerCode": "00010966", | |
333 | - "amount": 0, | |
334 | - "source": "wechatApplet", | |
335 | - "deliveryMethod": "homeDelivery", | |
336 | - "cityId": "510100", | |
337 | - "cityName": "成都市", | |
338 | - "shopCode": "S001953", | |
339 | - "shopName": "成都SAC新店0001", | |
340 | - "useFreeAmount": 0, | |
341 | - "items": [{ | |
342 | - "areaId": "110100", | |
343 | - "productId": 301, | |
344 | - "productCode": "PD2019021100000001", | |
345 | - "productName": "猕猴桃", | |
346 | - "price": 0, | |
347 | - "quantity": 1 | |
348 | - }] | |
349 | - } | |
350 | -expect_Response={"code":"5000","result":"商品沈阳独立商品超过购买限制,限制购买总数为0","success":false} | |
351 | 0 | \ No newline at end of file |
src/config/api/submitOrder.xlsx deleted
100644 → 0
No preview for this file type
src/config/api/undertaskOrderSubmit.conf deleted
100644 → 0
1 | -# -*- coding: UTF-8 -*- | |
2 | - | |
3 | -[undertaskOrderSubmit01] | |
4 | -url=http://oms.tms.nong12.com/undertakeOrder/undertaskOrderSubmit.action | |
5 | - | |
6 | -update_header01={"Content-Type":"application/json;charset=UTF-8","Referer":"http://oms.tms.nong12.com/undertakeOrder/preSubmit.html"} | |
7 | - | |
8 | -body={"ids":["0","1097","1098"],"vt":"0017","vehicleType":"0017","vehicleTypeText":"电动车","driver":"好司机"} | |
9 | - | |
10 | -expect_response={"code":"200","message":"OK","result":"OK","success":true} | |
11 | - | |
12 | - | |
13 | - |
src/config/api/upStream.conf
0 → 100644
1 | +# -*- coding: UTF-8 -*- | |
2 | + | |
3 | +[upStream01] | |
4 | +method=post | |
5 | +url=http://test.trace.diligrp.com:8393/upStream/listPage.action | |
6 | +body_format=JSON | |
7 | +header={ | |
8 | + "Host": "test.trace.diligrp.com", | |
9 | + "Connection": "keep-alive", | |
10 | + "Content-Length": "325", | |
11 | + "Accept": "application/json,text/javascript,*/*;q=0.01", | |
12 | + "X-Requested-With": "XMLHttpRequest", | |
13 | + "User-Agent": "Mozilla/5.0(WindowsNT10.0;Win64;x64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/90.0.4430.212Safari/537.36", | |
14 | + "Content-Type": "application/json", | |
15 | + "Origin": "http://test.trace.diligrp.com:8393", | |
16 | + "Referer": "http://test.trace.diligrp.com:8393/upStream/index.html", | |
17 | + "Accept-Encoding": "gzip,deflate", | |
18 | + "Accept-Language": "zh-CN,zh-TW;q=0.9,zh;q=0.8,en;q=0.7"} | |
19 | + | |
20 | +body={"rows":10,"page":1,"sort":"id","order":"desc","metadata":{"created":"{\"provider\":\"datetimeProvider\",\"index\":10,\"field\":\"created\"}","upORdown":"{\"provider\":\"userFlagProvider\",\"index\":20,\"field\":\"upORdown\"}","upstreamType":"{\"provider\":\"upStreamTypeProvider\",\"index\":30,\"field\":\"upstreamType\"}"}} | |
21 | + | |
22 | + | |
23 | +expect_response={"code":"200","data":951,"message":"创建客户订单成功","result":"创建客户订单成功","success":true} | |
24 | + | ... | ... |
src/config/api/updateTransportOrderLoaded.conf deleted
100644 → 0
1 | -# -*- coding: UTF-8 -*- | |
2 | - | |
3 | -[updateTransportOrderLoaded01] | |
4 | -url=http://oms.tms.nong12.com/transportOrder/updateTransportOrderLoaded.action | |
5 | - | |
6 | -update_header01={"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8","Referer":"http://oms.tms.nong12.com/transportOrder/add.html"} | |
7 | - | |
8 | - | |
9 | -body={ | |
10 | - "id": "638", | |
11 | - "driver": "好司机", | |
12 | - "licensePlate": "车辆信息666", | |
13 | - "undertTakeOrderUpdateDtoList[0].underTakeOrderId": "1101", | |
14 | - "undertTakeOrderUpdateDtoList[0].origin": "四川省,成都市,锦江区", | |
15 | - "undertTakeOrderUpdateDtoList[0].originId": "510104", | |
16 | - "undertTakeOrderUpdateDtoList[0].certificateUrl": "", | |
17 | - "undertTakeOrderUpdateDtoList[0].brand": "", | |
18 | - "undertTakeOrderUpdateDtoList[1].underTakeOrderId": "1102", | |
19 | - "undertTakeOrderUpdateDtoList[1].origin": "四川省,成都市,锦江区", | |
20 | - "undertTakeOrderUpdateDtoList[1].originId": "510104", | |
21 | - "undertTakeOrderUpdateDtoList[1].certificateUrl": "", | |
22 | - "undertTakeOrderUpdateDtoList[1].brand": "", | |
23 | - "feeMap[zhuanxiefei]": "0", | |
24 | - "feeMap[dakuang]": "0", | |
25 | - "loader": "装货王菲", | |
26 | - "loadingPlaceId": "31", | |
27 | - "attachments": "group1/M00/00/57/ChwMf13c4ZaAJwgDAACC74HdADg141.jpg"} | |
28 | - | |
29 | -expect_response={"code":"200","message":"OK","result":"OK","success":true} | |
30 | - | |
31 | - |
src/report/test.log
1 | -[2021-05-14 15:46:30] [INFO] : 发送的邮件地址[]: | |
2 | -[2021-05-14 15:46:30] [INFO] : 运行的用例优先级[]: | |
3 | -[2021-05-14 15:46:30] [INFO] : 运行的用例标记False: | |
4 | -[2021-05-14 15:46:30] [INFO] : 测试用例加载结果<unittest.suite.TestSuite tests=[<test_skip_demo.test_skipclass.test_skipclass_demo1 testMethod=test_1_skipclass>, <test_skip_demo.test_skipclass.test_skipclass_demo1 testMethod=test_2_skipclass>, <test_skip_demo.test_skipclass.test_skipclass_demo1 testMethod=test_3_skipclass>, <test_skip_demo.test_skipclass.test_skipclass_demo1 testMethod=test_4_skipclass>, <test_skip_demo.test_skipclass.test_skipclass_demo1 testMethod=test_5_skipclass>, <test_skip_demo.test_skipclass.test_skipclass_demo1 testMethod=test_6_skipclass>, <test_skip_demo.test_skipclass.test_skipclass_demo1 testMethod=test_7_skipclass>, <test_skip_demo.test_Systemskip.test_systemskip_demo1 testMethod=test_1_systemskip>, <test_skip_demo.test_Systemskip.test_systemskip_demo1 testMethod=test_2_systemskip>, <test_skip_demo.test_Systemskip.test_systemskip_demo1 testMethod=test_3_systemskip>, <test_skip_demo.test_Systemskip.test_systemskip_demo1 testMethod=test_4_systemskip>, <test_skip_demo.test_Systemskip.test_systemskip_demo1 testMethod=test_5_systemskip>, <test_skip_demo.test_Systemskip.test_systemskip_demo1 testMethod=test_6_systemskip>, <test_skip_demo.test_Systemskip.test_systemskip_demo1 testMethod=test_7_systemskip>, <test_skip_demo.test_Userskip.test_Userskip_demo1 testMethod=test_1_userskip>, <test_skip_demo.test_Userskip.test_Userskip_demo1 testMethod=test_2_userskip>, <test_skip_demo.test_Userskip.test_Userskip_demo1 testMethod=test_3_userskip>, <test_skip_demo.test_Userskip.test_Userskip_demo1 testMethod=test_4_userskip>, <test_skip_demo.test_Userskip.test_Userskip_demo1 testMethod=test_5_userskip>, <test_skip_demo.test_Userskip.test_Userskip_demo1 testMethod=test_6>]> | |
5 | -[2021-05-14 15:46:30] [INFO] : 测试报告路径E:\EclipseWorkspace\WorksapceDemo\Request-demo\src/report/2021-05-14 15_46_30_result.html: | |
6 | -[2021-05-14 15:46:30] [INFO] : ********运行测试用例******** | |
7 | -[2021-05-14 15:46:30] [INFO] : 发送邮件 | |
8 | -[2021-05-14 15:46:35] [INFO] : 邮件发送完毕 | |
9 | -2021-05-14 15:46:30] [INFO] : 发送邮件 | |
10 | -[2021-05-14 15:46:35] [INFO] : 邮件发送完毕 | |
1 | +[2021-05-28 18:09:36] [INFO] : =============================请求接口为test_01_upStream============================== | |
2 | +[2021-05-28 18:09:36] [INFO] : 请求地址为http://test.trace.diligrp.com:8393/upStream/listPage.action; 请求方式为post; 请求body格式为JSON; | |
3 | + 请求body为None{'rows': 10, 'page': 1, 'sort': 'id', 'order': 'desc', 'metadata': {'created': '{"provider":"datetimeProvider","index":10,"field":"created"}', 'upORdown': '{"provider":"userFlagProvider","index":20,"field":"upORdown"}', 'upstreamType': '{"provider":"upStreamTypeProvider","index":30,"field":"upstreamType"}'}}; | |
4 | +[2021-05-28 18:09:42] [INFO] : 响应body为{'rows': [{'upORdown': '上游', '$_upORdown': 10, 'created': '2021-05-26 15:04:27', 'businessLicenseUrl': '3b4af72d6872418a8898b1788bf3477f', '$_upstreamType': 20, 'marketId': 8, 'license': '666666', 'legalPerson': '法人代表', 'telphone': '13111111111', 'name': '一号测试上游企业', 'modified': 1622012667000, 'userNames': '测试一号', 'id': 340, 'sourceUserId': 516, 'upstreamType': '企业'}, {'upORdown': '上游', '$_upORdown': 10, 'created': '2021-05-24 17:35:48', 'idCard': '513001199105081258', '$_upstreamType': 10, 'marketId': 8, 'cardNoBackUrl': '', 'telphone': '18380475463', 'cardNoFrontUrl': '', 'name': '杨我', 'modified': 1621848948000, 'userNames': '地利人和', 'id': 339, 'sourceUserId': 131138, 'upstreamType': '个人'}, {'upORdown': '上游', '$_upORdown': 10, 'created': '2021-05-20 14:19:19', 'idCard': '513001199802081012', '$_upstreamType': 10, 'marketId': 8, 'cardNoBackUrl': '', 'telphone': '18380475463', 'cardNoFrontUrl': '', 'name': '爱情保卫战', 'modified': 1621491559000, 'userNames': '成都广场', 'id': 338, 'sourceUserId': 131155, 'upstreamType': '个人'}, {'upORdown': '上游', '$_upORdown': 10, 'created': '2021-05-18 10:39:22', 'idCard': '513001199802081258', '$_upstreamType': 10, 'marketId': 8, 'cardNoBackUrl': '', 'telphone': '18680475463', 'cardNoFrontUrl': '', 'name': '刘策', 'modified': 1621305562000, 'userNames': '啊撒米', 'id': 337, 'sourceUserId': 131135, 'upstreamType': '个人'}, {'upORdown': '上游', '$_upORdown': 10, 'created': '2021-05-10 09:42:51', 'idCard': '', '$_upstreamType': 10, 'marketId': 8, 'cardNoBackUrl': '', 'telphone': '13540782311', 'cardNoFrontUrl': '', 'name': '111', 'modified': 1620610971000, 'userNames': '雪额外大', 'id': 333, 'sourceUserId': 616, 'upstreamType': '个人'}, {'upORdown': '下游', '$_upORdown': 20, 'created': '2021-04-29 11:07:19', 'businessLicenseUrl': '', '$_upstreamType': 20, 'marketId': 8, 'operationLicenseUrl': '', 'license': '', 'legalPerson': '', 'telphone': '', 'name': '投入', 'modified': 1619665639000, 'userNames': '杨旭旭旭', 'id': 326, 'sourceUserId': 130500, 'manufacturingLicenseUrl': '', 'upstreamType': '企业'}, {'upORdown': '下游', '$_upORdown': 20, 'created': '2021-04-29 11:05:04', 'idCard': '513001199802081011', '$_upstreamType': 10, 'marketId': 8, 'cardNoBackUrl': '', 'telphone': '18380475463', 'cardNoFrontUrl': '', 'name': '12', 'modified': 1619665504000, 'userNames': '杰伦的', 'id': 325, 'sourceUserId': 515, 'upstreamType': '个人'}, {'upORdown': '上游', '$_upORdown': 10, 'created': '2021-04-29 10:38:20', 'businessLicenseUrl': '570da30d70f847edbceec3170c5bd065', '$_upstreamType': 20, 'marketId': 8, 'license': '111111', 'legalPerson': '法人', 'telphone': '13111111111', 'name': '企业名称', 'modified': 1619663900000, 'userNames': '多少啊', 'id': 324, 'sourceUserId': 606, 'upstreamType': '企业'}, {'upORdown': '上游', '$_upORdown': 10, 'created': '2021-04-26 15:12:36', 'idCard': '513001199608081580', '$_upstreamType': 10, 'marketId': 8, 'cardNoBackUrl': '', 'telphone': '18580454632', 'cardNoFrontUrl': '', 'name': '15', 'modified': 1619421156000, 'userNames': '杨旭旭旭', 'id': 320, 'sourceUserId': 130500, 'upstreamType': '个人'}, {'upORdown': '上游', '$_upORdown': 10, 'created': '2021-04-26 15:12:16', 'idCard': '513001199608081580', '$_upstreamType': 10, 'marketId': 8, 'cardNoBackUrl': '', 'telphone': '18380475460', 'cardNoFrontUrl': '', 'name': '两休息', 'modified': 1619421136000, 'userNames': '杨旭旭旭', 'id': 319, 'sourceUserId': 130500, 'upstreamType': '个人'}], 'total': 203}; | ... | ... |
src/testcase/test_tms_myrequest/test_upStream.py
0 → 100644
1 | +#!/usr/bin/python | |
2 | +# -*- coding: UTF-8 -*- | |
3 | +import unittest | |
4 | +import json | |
5 | +import urllib3 | |
6 | +from commons import ConfigDB as db | |
7 | +from commons import common as com | |
8 | +from commons.MyRequest import myrequest | |
9 | +urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) | |
10 | +my=myrequest() | |
11 | + | |
12 | +#列表查询 | |
13 | +class test_upStream(unittest.TestCase): | |
14 | + | |
15 | + @classmethod | |
16 | + def setUpClass(cls): | |
17 | + #新增登记单 | |
18 | + cls.se=my.getSession(True) | |
19 | + #由于可能有多种情况所以使用传统的setup | |
20 | + def setUp(self): | |
21 | +# #新增登记单 | |
22 | +# my.registerBill_insert(True) | |
23 | + pass | |
24 | + @unittest.case_config(com.mark()) | |
25 | + def test_01_upStream(self): | |
26 | + #查询上下游企业 | |
27 | + re=my.post2("test_01_upStream") | |
28 | + print(re.json()) | |
29 | + | |
30 | + def test_02_upStream(self): | |
31 | + #新增理货区进场登记单,获取新增前最新的登记单id | |
32 | +# code=db.mysql_selectOne('SELECT code FROM `register_bill` WHERE id="{}";'.format(my.temp[0]))[0] | |
33 | +# #获取接口参数 | |
34 | +# url=com.get_module_config('registerBill', 'listPage', 'listPage01', 'url') | |
35 | +# header=json.loads(com.get_module_config('registerBill', 'listPage', 'listPage01', 'header')) | |
36 | +# body=com.get_module_config('registerBill', 'listPage', 'listPage01', 'body') | |
37 | +# body=body.replace("d2020082700076",code) | |
38 | +# expect_response=json.loads(com.get_module_config('registerBill', 'listPage', 'listPage01', 'expect_response')) | |
39 | +# #进行接口请求,两种方式之一data | |
40 | +# r=my.post(url,data=(body.encode().decode('unicode-escape')),headers=header) | |
41 | +# print(r.json()) | |
42 | +# #进行接口断言 | |
43 | +# self.assertEqual(r.json()["rows"][0]["code"], code," request failed") | |
44 | +# self.assertEqual(com.compare_json(r.json(),expect_response),None,"json compare failed") | |
45 | + pass | |
46 | + | |
47 | + def tearDown(self): | |
48 | + | |
49 | + print("tearDown") | |
50 | + | |
51 | + @classmethod | |
52 | + def tearDownClass(cls): | |
53 | + cls.se.close() | |
54 | + | |
55 | +if __name__ == "__main__": | |
56 | +#unittest.main()方法会搜索该模块文件下所有以test开头的测试用例方法,并自动执行它们。 | |
57 | +#如果不加下面这个语句,那么在通过unittest的方法添加测试用例时,这个文件里面的用例不会被搜索到。 | |
58 | + | |
59 | + unittest.main(verbosity=2) | |
60 | + | |
61 | +# # 以下代码可以调试单个测试用例,用例中打印的语句不会展示到控制台,使用前需要注释上面的代码unittest.main(),如果不使用下面代码, | |
62 | +# # 在有unittest.main()的情况下点击ctrl+f11,会直接运行当前页面所有用例,并且把用例用有打印的语句显示到控制台 | |
63 | +# current_suite = unittest.TestSuite() | |
64 | +# current_suite.addTest(submitOrder("test_01")) | |
65 | +# #以列表形式添加多个测试用例 | |
66 | +# # current_suite.addTests([submitOrder_With_Coupon("test_01"),submitOrder_With_Coupon("test_02")]) | |
67 | +# # 执行测试 | |
68 | +# runner = unittest.TextTestRunner() | |
69 | +# #runner.run(可以直接添加测试用例如submitOrder_With_Coupon("test_01")) | |
70 | +# runner.run(current_suite) | |
0 | 71 | \ No newline at end of file | ... | ... |