Commit 6cac9e12 authored by wangliping's avatar wangliping

123

parents
Pipeline #10904 failed with stages
# EZ_TEST 使用说明
1. excel用例编写说明
![image-20210202111839946](C:\Users\huhong\AppData\Roaming\Typora\typora-user-images\image-20210202111839946.png)
2. 场景用例组装
![image-20210202112035198](C:\Users\huhong\AppData\Roaming\Typora\typora-user-images\image-20210202112035198.png)
3. 复杂逻辑扩展
![image-20210202112329010](C:\Users\huhong\AppData\Roaming\Typora\typora-user-images\image-20210202112329010.png)
4. ini中配置
![image-20210209160825653](C:\Users\huhong\AppData\Roaming\Typora\typora-user-images\image-20210209160825653.png)
\ No newline at end of file
from base.logs import case_log
from base.setting import setting
loginfo = case_log()
\ No newline at end of file
import requests
import json
from base.setting import setting
from requests.packages.urllib3.exceptions import InsecureRequestWarning
from base import loginfo
import socket
socket.setdefaulttimeout(20)
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
class ApiRequests:
"""
请求类,对请求的方法,数据的处理,主要json数据类型
"""
def __init__(self, header=None):
self.header = json.loads(setting.env['header'])
if header:
self.header.update(header)
def post_main(self, url, data):
return requests.post(url=url, data=data, headers=self.header, verify=False)
def get_main(self, url):
return requests.get(url=url, headers=self.header, verify=False)
def run_main(self, url, data=None, flag=True, method='post'):
"""
:param url: 接口地址
:param data: 请求数据
:param flag: 是否执行
:param method: 请求方式
:return: 结果数据
"""
url = setting.env['domain'] + url
if flag:
# 进行编码处理
if method.lower() == 'get':
res = self.get_main(url)
else:
loginfo.debug('请求参数: \n\t\t\t\t\t\t{}'.format(data))
res = self.post_main(url, json.dumps(data))
return res.content.decode('utf-8')
This diff is collapsed.
import logging
from logging import handlers
from base.setting import setting
import time
import os
log_name = os.path.join(setting.log_path['path'], time.strftime('%Y-%m-%d', time.localtime()) + '-log.log')
def case_log():
log_format = '%(asctime)s - %(filename)s[line:%(lineno)d] - %(levelname)s: %(message)s'
logging.basicConfig(level=logging.DEBUG, format=log_format)
logger = logging.getLogger()
# 屏幕写入
# th = logging.StreamHandler()
# 文件输出
format_str = logging.Formatter(log_format)
sh = handlers.TimedRotatingFileHandler(filename=log_name, when='D', encoding='utf-8')
sh.setFormatter(format_str)
logger.addHandler(sh)
# logger.addHandler(th)
return logger
if __name__ == '__main__':
log = case_log()
log.debug('hello')
\ No newline at end of file
"""
配置类,读取配置信息
"""
import configparser
import os
class Setting:
def __init__(self, path=None):
if not path:
base_path = os.path.dirname(os.path.abspath(os.path.dirname(__file__)))
self.config_path = os.path.join(base_path, 'config/config.ini')
else:
self.config_path = path
self.config = configparser.ConfigParser()
self.config.read(self.config_path, encoding='utf-8')
self.setting()
def setting(self):
for attr in self.config.sections():
self.__dict__[attr] = dict(self.config.items(attr))
setting = Setting()
from util.excel_data import OperatorExcel
import copy
class TestData:
def __init__(self, file=None):
api_datas = OperatorExcel(file).get_all_case()
scene_datas = OperatorExcel(file).get_scene_case()
self.title, self.case_data = api_datas[0], api_datas[1:]
self.scene_title, self.scene_data = scene_datas[0], scene_datas[1:]
def get_data(self):
case_datas = []
for case in self.case_data:
case_dict = {}
for index, title in enumerate(self.title):
case_dict[title] = case[index]
case_datas.append(case_dict)
return case_datas
def get_scene_data(self):
scene_datas = []
for case in self.scene_data:
case_dict = {}
for index, title in enumerate(self.scene_title):
case_dict[title] = case[index]
scene_datas.append(case_dict)
for scene in scene_datas:
if scene['scene_case']:
a = copy.deepcopy(scene['scene_case'])
tmp_case = copy.deepcopy(a.split('-'))
tmp_cases = []
for c in tmp_case:
for cc in self.get_data():
if c == cc['name']:
tmp_cases.append(cc)
scene['scene_case'] = tmp_cases
return scene_datas
if __name__ == '__main__':
TestData().get_scene_data()
import json
import os
from base import loginfo
from base.setting import setting
class TestCase:
"""
测试基类
"""
def __init__(self, **kwargs):
"""
:param name: 用例名称
:param priority: 优先级 1,2,3
:param api_address: 请求地址
:param save_field: 需要保存的字段
:param method: 请求方法 post,get
:param data: 请求参数
:param expected: 期望结果
:param actual: 实际结果
:param case_pass: 是否通过 成功,失败
"""
self.name = kwargs.get('name')
self.priority = kwargs.get('priority')
self.api_address = kwargs.get('api_address')
self.method = kwargs.get('method')
# 请求参数--需要转换成json,支持以F=开头的路径方式传入
self.request_data = kwargs.get('request_data')
if str(self.request_data).startswith('F='):
path = self.request_data.split('F=')[-1]
if setting.json_data['json_data_path']:
base_path = setting.json_data['json_data_path']
self.request_data = self.read_json_case(os.path.join(base_path, path))
else:
self.request_data = self.read_json_case(path)
elif isinstance(self.request_data, str):
if self.request_data:
self.request_data = json.loads(self.request_data)
self.expected = kwargs.get('expected')
self.actual = kwargs.get('actual')
self.case_pass = kwargs.get('case_pass')
self.assert_method = kwargs.get('assert_method')
self.save_field = kwargs.get('save_field')
self.logs = None
def read_json_case(self, path):
with open(path, 'r', encoding='utf-8') as fp:
data = fp.read()
try:
data = json.loads(data)
except Exception as e:
print('json数据转换失败{}'.format(e))
finally:
return data
def api_assert(self):
"""
根据传入参数调用断言方法
:return: bool
"""
loginfo.debug('期望结果: {}, 断言方式: {}'.format(self.expected, self.assert_method))
if self.assert_method == 'include_text':
self.include_text()
elif self.assert_method == 'include_json':
self.include_json()
elif self.assert_method == 'equal_text':
self.equal_text()
# elif self.assert_method == '':
# self.assert_json()
else:
self.equal_json()
# 文本包含
def include_text(self):
if self.expected in str(self.actual):
self.case_pass = True
# json包含
def include_json(self):
if isinstance(self.expected, str):
self.expected = json.loads(self.expected)
if isinstance(self.actual, str):
self.actual = json.loads(self.actual)
if self.assert_json(self.expected, self.actual):
self.case_pass = True
def assert_json(self, exp, act):
if exp == act:
return True
elif isinstance(exp, dict):
for j in exp.keys():
if j in act:
return self.assert_json(exp[j], act[j])
else:
return False
elif isinstance(exp, list) and isinstance(act, list):
for i in exp:
if i in act:
return self.assert_json(i, act[act.index(i)])
else:
return False
else:
return False
# 文本相等
def equal_text(self):
if self.expected == self.actual:
self.case_pass = True
# json相等
def equal_json(self):
if self.expected == self.actual:
self.case_pass = True
if __name__ == '__main__':
a = {"code":'0'}
b = {"code":'0'}
print(a)
print(b)
a = TestCase().assert_json(a, b)
print(a)
[env]
domain=https://hmdh--gbltest.dev1.logwirecloud.com/
header={"Content-Type": "application/json;charset=UTF-8","User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.104 Safari/537.36"}
[login]
username=test
password=test
[log_path]
path=../logs/
[report]
name=API-TEST-DEMO
report_path=../report/report.html
[json_data]
json_data_path=../data/json_data/
[warehouse_rule]
warehouse_name=GQC-广汽中心仓
warehouse_code=GQC-广汽中心仓
[seq_env]
start=0
step=2
[user_name]
user_name=张三
name_xid=123456
[env]
domain=http://119.3.73.53:18082/
header={"Content-Type": "application/json;charset=UTF-8","User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.104 Safari/537.36"}
[login]
username=ADMIN
password=password
[log_path]
path=../logs/
[report]
name=API-TEST-DEMO
report_path=../report/report.html
[json_data]
json_data_path=../data/json_data/
[warehouse_rule]
warehouse_name=茶园⼯⼚-线边仓
warehouse_code=2003
"""
支持用例编写的另一种方式--相较于excel,使用py文件编写用例,可用python相关的一些方法来制造数据,更加灵活
"""
import random
from base.setting import setting
whid =setting.warehouse_rule['warehouse_name']
ruleid = whid + '预分配规则'
# 接口用例合集
API = [
{'name': 'auto', 'priority': '1',
'api_address': 'api/query/warehouse_auto_q/auto',
'save_field': 'id=$.data.datas[?(@.name=="{}")].id'.format(whid), 'method': 'post',
'request_data': 'F=auto.json', 'expected': {"messageType": "success"},
'assert_method': 'include_json'},
{'name': 'batch_rule', 'priority': '1',
'api_address': 'api/query/rule_lot_q/action/commonSave',
'save_field': '', 'method': 'post',
'request_data': 'F=batch_rule.json', 'expected': {"messageType": "success"},
'assert_method': 'include_json'},
{'name': 'mixing_rule', 'priority': '1',
'api_address': 'api/query/rule_mix_storage_q/action/commonSave',
'save_field': '', 'method': 'post',
'request_data': 'F=mixing_rule.json', 'expected': {"messageType": "success"},
'assert_method': 'include_json'},
{'name': 'receiving_verification_rule', 'priority': '1',
'api_address': 'api/query/rule_in_validation_q/action/commonSave',
'save_field': '', 'method': 'post',
'request_data': 'F=receiving_verification_rule.json', 'expected': {"messageType": "success"},
'assert_method': 'include_json'},
{'name': 'turnover_rule', 'priority': '1',
'api_address': 'api/query/rule_rotate_q/action/commonSave',
'save_field': 'turnover_rule_id=$.data.header.id', 'method': 'post',
'request_data': 'F=turnover_rule.json', 'expected': {"messageType": "success"},
'assert_method': 'include_json'},
{'name': 'listing_rule', 'priority': '1',
'api_address': 'api/query/rule_putaway_q/action/commonSave',
'save_field': 'listing_rule_id=$.data.header.id', 'method': 'post',
'request_data': 'F=listing_rule.json', 'expected': {"messageType": "success"},
'assert_method': 'include_json'},
{'name': 'listing_rule_s', 'priority': '1',
'api_address': 'api/query/rule_putaway_q/action/commonSave',
'save_field': '', 'method': 'post',
'request_data': 'F=listing_rule.json', 'expected': {"messageType": "success"},
'assert_method': 'include_json'},
{'name': 'pre_allocation_rule', 'priority': '1',
'api_address': 'api/query/rule_preallocate_q/action/commonSave',
'save_field': 'pre_allocation_id=$.data.header.id', 'method': 'post',
'request_data': 'F=pre_allocation_rule.json', 'expected': {"messageType": "success"},
'assert_method': 'include_json'},
{'name': 'allocation_rule', 'priority': '1',
'api_address': 'api/query/rule_allocate_q/action/commonSave',
'save_field': '', 'method': 'post',
'request_data': 'F=allocation_rule.json', 'expected': {"messageType": "success"},
'assert_method': 'include_json'},
{'name': 'cutbox_rule', 'priority': '1',
'api_address': 'api/query/rule_cutbox_q/action/commonSave',
'save_field': '', 'method': 'post',
'request_data': 'F=cutbox_rule.json', 'expected': {"messageType": "success"},
'assert_method': 'include_json'},
{'name': 'wave_rule', 'priority': '1',
'api_address': 'api/query/rule_wave_q/action/commonSave',
'save_field': '', 'method': 'post',
'request_data': 'F=wave_rule.json', 'expected': {"messageType": "success"},
'assert_method': 'include_json'},
{'name': 'pick_order_rule', 'priority': '1',
'api_address': 'api/query/rule_pick_order_q/action/commonSave',
'save_field': '', 'method': 'post',
'request_data': 'F=pick_order_rule.json', 'expected': {"messageType": "success"},
'assert_method': 'include_json'},
{'name': 'out_validation_rule', 'priority': '1',
'api_address': 'api/query/rule_out_validation_q/action/commonSave',
'save_field': '', 'method': 'post',
'request_data': 'F=out_validation_rule.json', 'expected': {"messageType": "success"},
'assert_method': 'include_json'},
{'name': 'make_kuwei', 'priority': '1',
'api_address': 'api/query/w_location/action/commonSave',
'save_field': '', 'method': 'post',
'request_data': 'F=make_kuwei.json', 'expected': {"messageType": "success"},
'assert_method': 'include_json'},
]
# 场景用例
SCENE = [{'name': 'make_kuwei',
'scene_case': ['make_kuwei'], 'priority': '', 'is_run': '1', 'case_pass': ''},
]
#[i['name'] for i in API]
if __name__ == '__main__':
print('re_allocation_id=$.data.header[?(@.name=="{}")].id'.format(ruleid))
\ No newline at end of file
{"selectedRows":[{"header":{"currentData":{"id":"","warehouse_id":"292114446938148864","code":"12","name":"121212","remark":"","enabled":true,"preallocate_rule_id":"","domain_name":"","version":"0","insert_user":"","insert_user_common_name":"","insert_date":"","update_user":"","update_user_common_name":"","update_date":"","warehouse__code":"10001","warehouse__name":"茶园工厂外库","preallocate__code":"","preallocate__name":"","_TX_CODE":""},"originalData":{"id":"","warehouse_id":"","code":"","name":"","remark":"","enabled":true,"preallocate_rule_id":"","domain_name":"","version":"0","insert_user":"","insert_user_common_name":"","insert_date":"","update_user":"","update_user_common_name":"","update_date":"","warehouse__code":"","warehouse__name":"","preallocate__code":"","preallocate__name":"","_TX_CODE":""}},"lines":{"rows":[]}}],"aux":{"new":true}}
\ No newline at end of file
{"keyword":null,"template":"${code!}-${name!}","restriction":null,"pageNum":0,"caseSensitive":true}
\ No newline at end of file
{"keyword":null,"template":"${code!}-${name!}","restriction":null,"fields":["code","name"],"pageNum":0,"caseSensitive":true,"queryFields":{"warehouse_id":""}}
\ No newline at end of file
{"selectedRows":[{"header":{"currentData":{"id":"","warehouse_id":"292114446938148864","code":"111111","name":"茶园工厂外库-批次规则","remark":"","status":true,"domain_name":"","version":"0","insert_user":"","insert_user_common_name":"","insert_date":"","update_user":"","update_user_common_name":"","update_date":"","warehouse__code":"10001","warehouse__name":"茶园工厂外库","_TX_CODE":""},"originalData":{"id":"","warehouse_id":"","code":"","name":"","remark":"","status":true,"domain_name":"","version":"0","insert_user":"","insert_user_common_name":"","insert_date":"","update_user":"","update_user_common_name":"","update_date":"","warehouse__code":"","warehouse__name":"","_TX_CODE":""}},"fields":{"rows":[]}}],"aux":{"new":true}}
\ No newline at end of file
{"selectedRows":[{"header":{"currentData":{"id":"","warehouse_id":"292114446938148864","code":"341324","name":"1234321","remark":"","enabled":true,"domain_name":"","version":"0","insert_user":"","insert_user_common_name":"","insert_date":"","update_user":"","update_user_common_name":"","update_date":"","warehouse__code":"10001","warehouse__name":"茶园工厂外库","_TX_CODE":""},"originalData":{"id":"","warehouse_id":"","code":"","name":"","remark":"","enabled":true,"domain_name":"","version":"0","insert_user":"","insert_user_common_name":"","insert_date":"","update_user":"","update_user_common_name":"","update_date":"","warehouse__code":"","warehouse__name":"","_TX_CODE":""}},"computes":{"rows":[]},"groups":{"rows":[]},"sorts":{"rows":[]}}],"aux":{"new":true}}
\ No newline at end of file
{"selectedRows":[{"header":{"currentData":{"id":"","warehouse_id":"292114446938148864","code":"345345","name":"123","remark":"","enabled":true,"domain_name":"","version":"0","insert_user":"","insert_user_common_name":"","insert_date":"","update_user":"","update_user_common_name":"","update_date":"","warehouse__code":"10001","warehouse__name":"茶园工厂外库","_TX_CODE":""},"originalData":{"id":"","warehouse_id":"","code":"","name":"","remark":"","enabled":true,"domain_name":"","version":"0","insert_user":"","insert_user_common_name":"","insert_date":"","update_user":"","update_user_common_name":"","update_date":"","warehouse__code":"","warehouse__name":"","_TX_CODE":""}},"lines":{"rows":[]}}],"aux":{"new":true}}
\ No newline at end of file
{"selectedRows":[{"header":{"currentData":{"id":"","model1":"","model2":"","model3":"","code":"SH-KW-L-001","refer_code":"SH-KW-L-001","name":"SH-KW-L-001","address":"292114735460126720","door":"","parent":"293318029012504576","truck":"","qty":"","avl_qty":"","length":2500,"width":500,"height":500,"longitude":"","latitude":"","gps_fence":"","wx_fence":"","truck_type":"","capacity_type":"volume","capacity_type_label":"","load_capacity":"","unload_capacity":"","static_minute":"","sort_num":"","detail":"","recognition":"","barrier":"","bulletin":"","speaker":"","parent2":"293318429983772672","roadway":"293308432495284224","storage_type":"","storage_type_label":"","shelf_type":"","shelf_type_label":"","x_coordinate":0,"y_coordinate":0,"z_coordinate":0,"x_coordinate2":"","y_coordinate2":"","z_coordinate2":"","bays":"","bay_length":"","bay_space":"","heap_lines":"","heap_tiers":"","row":"","column":"","layer":"","layer_count":"","abc_type":"","abc_type_label":"","line_order":"","line_order2":"","line_order3":"","floor":"","volume":"","ground_pallet_count":"","stack_limit":"","pack_handle_type":"","pack_handle_type_label":"","lose_id":false,"mix_rule_id":"","zone_row_mix_rule_id":"","zone_col_mix_rule_id":"","mix_rule_name":"","zone_row_mix_rule_name":"","zone_col_mix_rule_name":"","storage_condition":"","storage_condition_label":"","sku_form_types":[],"sku_form_types_label":"","section_type":"OTHER","section_type_label":"","enabled":true,"description":"","effective_date":"","expiration_date":"","dock_type":"","dock_type_label":"","gateway_type":"","gateway_type_label":"","operation_interval":"","berthing_time":"","rule":"","calendar":"","is_auto":false,"is_open":true,"zone":"","hight_low_type":"","hight_low_type_label":"","w_zone_type":"","w_zone_type_label":"","w_location_type":"","w_location_type_label":"","roadway_in_location_id":"","roadway_out_location_id":"","zone_stage_location_id":"","domain_name":"","version":"0","insert_user":"","insert_user_common_name":"","insert_date":"","update_user":"","update_user_common_name":"","update_date":"","warehouse__code":"10002","warehouse__name":"上海 DC 库","section__code":"","section__name":"","section__section_type":"","section__section_type_label":"","zone__code":"SH-KQ001","zone__name":"SH-KQ001","roadway__code":"SH-XD001","roadway__name":"SH-XD001","_TX_CODE":""},"originalData":{"id":"","model1":"","model2":"","model3":"","code":"","refer_code":"","name":"","address":"","door":"","parent":"","truck":"","qty":"","avl_qty":"","length":"","width":"","height":"","longitude":"","latitude":"","gps_fence":"","wx_fence":"","truck_type":"","capacity_type":"volume","capacity_type_label":"","load_capacity":"","unload_capacity":"","static_minute":"","sort_num":"","detail":"","recognition":"","barrier":"","bulletin":"","speaker":"","parent2":"","roadway":"","storage_type":"","storage_type_label":"","shelf_type":"","shelf_type_label":"","x_coordinate":"","y_coordinate":"","z_coordinate":"","x_coordinate2":"","y_coordinate2":"","z_coordinate2":"","bays":"","bay_length":"","bay_space":"","heap_lines":"","heap_tiers":"","row":"","column":"","layer":"","layer_count":"","abc_type":"","abc_type_label":"","line_order":"","line_order2":"","line_order3":"","floor":"","volume":"","ground_pallet_count":"","stack_limit":"","pack_handle_type":"","pack_handle_type_label":"","lose_id":false,"mix_rule_id":"","zone_row_mix_rule_id":"","zone_col_mix_rule_id":"","mix_rule_name":"","zone_row_mix_rule_name":"","zone_col_mix_rule_name":"","storage_condition":"","storage_condition_label":"","sku_form_types":"","sku_form_types_label":"","section_type":"","section_type_label":"","enabled":true,"description":"","effective_date":"","expiration_date":"","dock_type":"","dock_type_label":"","gateway_type":"","gateway_type_label":"","operation_interval":"","berthing_time":"","rule":"","calendar":"","is_auto":false,"is_open":true,"zone":"","hight_low_type":"","hight_low_type_label":"","w_zone_type":"","w_zone_type_label":"","w_location_type":"","w_location_type_label":"","roadway_in_location_id":"","roadway_out_location_id":"","zone_stage_location_id":"","domain_name":"","version":"0","insert_user":"","insert_user_common_name":"","insert_date":"","update_user":"","update_user_common_name":"","update_date":"","warehouse__code":"","warehouse__name":"","section__code":"","section__name":"","section__section_type":"","section__section_type_label":"","zone__code":"","zone__name":"","roadway__code":"","roadway__name":"","_TX_CODE":""}}}],"aux":{"new":true}}
\ No newline at end of file
{
"selectedRows":[
{
"header":{
"currentData":{
"id":"",
"model1":"",
"model2":"",
"model3":"",
"code":"A1-A1-1-101",
"refer_code":"A1-A1-1-101",
"name":"A1-A1-1-101",
"address":"293329199773646848",
"door":"",
"parent":"293332980317945856",
"truck":"",
"qty":"",
"avl_qty":"",
"length":1000,
"width":1000,
"height":500,
"longitude":"",
"latitude":"",
"gps_fence":"",
"wx_fence":"",
"truck_type":"",
"capacity_type":"volume",
"capacity_type_label":"",
"load_capacity":"",
"unload_capacity":"",
"static_minute":"",
"sort_num":"",
"detail":"",
"recognition":"",
"barrier":"",
"bulletin":"",
"speaker":"",
"parent2":"293333187927605248",
"roadway":"293331476613824512",
"storage_type":"STORAGE",
"storage_type_label":"",
"shelf_type":"",
"shelf_type_label":"",
"x_coordinate":0,
"y_coordinate":0,
"z_coordinate":0,
"x_coordinate2":"",
"y_coordinate2":"",
"z_coordinate2":"",
"bays":"",
"bay_length":"",
"bay_space":"",
"heap_lines":"",
"heap_tiers":"",
"row":"",
"column":"",
"layer":"",
"layer_count":"",
"abc_type":"",
"abc_type_label":"",
"line_order":"",
"line_order2":"",
"line_order3":"",
"floor":"",
"volume":"",
"ground_pallet_count":"",
"stack_limit":"",
"pack_handle_type":"",
"pack_handle_type_label":"",
"lose_id":false,
"mix_rule_id":"",
"zone_row_mix_rule_id":"",
"zone_col_mix_rule_id":"",
"mix_rule_name":"",
"zone_row_mix_rule_name":"",
"zone_col_mix_rule_name":"",
"storage_condition":"",
"storage_condition_label":"",
"sku_form_types":[
],
"sku_form_types_label":"",
"section_type":"OTHER",
"section_type_label":"",
"enabled":true,
"description":"",
"effective_date":"",
"expiration_date":"",
"dock_type":"",
"dock_type_label":"",
"gateway_type":"",
"gateway_type_label":"",
"operation_interval":"",
"berthing_time":"",
"rule":"",
"calendar":"",
"is_auto":false,
"is_open":true,
"zone":"",
"lot_type":"",
"lot_type_label":"",
"hight_low_type":"",
"hight_low_type_label":"",
"w_zone_type":"",
"w_zone_type_label":"",
"w_location_type":"",
"w_location_type_label":"",
"roadway_in_location_id":"",
"roadway_out_location_id":"",
"zone_stage_location_id":"",
"domain_name":"",
"version":"0",
"insert_user":"",
"insert_user_common_name":"",
"insert_date":"",
"update_user":"",
"update_user_common_name":"",
"update_date":"",
"warehouse__code":"GQC-广汽中心仓",
"warehouse__name":"GQC-广汽中心仓",
"section__code":"",
"section__name":"",
"section__section_type":"",
"section__section_type_label":"",
"zone__code":"GQ-KQ-A-100",
"zone__name":"GQ-KQ-A-100",
"roadway__code":"GQ-XD-100",
"roadway__name":"GQ-XD-100",
"_TX_CODE":""
},
"originalData":{
"id":"",
"model1":"",
"model2":"",
"model3":"",
"code":"",
"refer_code":"",
"name":"",
"address":"",
"door":"",
"parent":"",
"truck":"",
"qty":"",
"avl_qty":"",
"length":"",
"width":"",
"height":"",
"longitude":"",
"latitude":"",
"gps_fence":"",
"wx_fence":"",
"truck_type":"",
"capacity_type":"volume",
"capacity_type_label":"",
"load_capacity":"",
"unload_capacity":"",
"static_minute":"",
"sort_num":"",
"detail":"",
"recognition":"",
"barrier":"",
"bulletin":"",
"speaker":"",
"parent2":"",
"roadway":"",
"storage_type":"",
"storage_type_label":"",
"shelf_type":"",
"shelf_type_label":"",
"x_coordinate":"",
"y_coordinate":"",
"z_coordinate":"",
"x_coordinate2":"",
"y_coordinate2":"",
"z_coordinate2":"",
"bays":"",
"bay_length":"",
"bay_space":"",
"heap_lines":"",
"heap_tiers":"",
"row":"",
"column":"",
"layer":"",
"layer_count":"",
"abc_type":"",
"abc_type_label":"",
"line_order":"",
"line_order2":"",
"line_order3":"",
"floor":"",
"volume":"",
"ground_pallet_count":"",
"stack_limit":"",
"pack_handle_type":"",
"pack_handle_type_label":"",
"lose_id":false,
"mix_rule_id":"",
"zone_row_mix_rule_id":"",
"zone_col_mix_rule_id":"",
"mix_rule_name":"",
"zone_row_mix_rule_name":"",
"zone_col_mix_rule_name":"",
"storage_condition":"",
"storage_condition_label":"",
"sku_form_types":"",
"sku_form_types_label":"",
"section_type":"",
"section_type_label":"",
"enabled":true,
"description":"",
"effective_date":"",
"expiration_date":"",
"dock_type":"",
"dock_type_label":"",
"gateway_type":"",
"gateway_type_label":"",
"operation_interval":"",
"berthing_time":"",
"rule":"",
"calendar":"",
"is_auto":false,
"is_open":true,
"zone":"",
"lot_type":"",
"lot_type_label":"",
"hight_low_type":"",
"hight_low_type_label":"",
"w_zone_type":"",
"w_zone_type_label":"",
"w_location_type":"",
"w_location_type_label":"",
"roadway_in_location_id":"",
"roadway_out_location_id":"",
"zone_stage_location_id":"",
"domain_name":"",
"version":"0",
"insert_user":"",
"insert_user_common_name":"",
"insert_date":"",
"update_user":"",
"update_user_common_name":"",
"update_date":"",
"warehouse__code":"",
"warehouse__name":"",
"section__code":"",
"section__name":"",
"section__section_type":"",
"section__section_type_label":"",
"zone__code":"",
"zone__name":"",
"roadway__code":"",
"roadway__name":"",
"_TX_CODE":""
}
}
}
],
"aux":{
"new":true
}
}
\ No newline at end of file
{"selectedRows":[{"currentData":{"effective_time":null,"pw_expiration_time":null,"dt_openid":null,"last_login_time":null,"activation_code":null,"dt_nickname":null,"insert_user":"DEFAULT.ADMIN","two_fa_enabled":false,"oidc_sub":null,"is_admin":false,"is_reserved":false,"domain_name":"DEFAULT","wx_openid":null,"update_user":null,"qq_nickname":null,"insert_user_common_name":null,"wx_nickname":null,"common_name":"张三","weixin_openid":null,"email":"123@qq.com","activation_state":true,"auth_type":"db","oidc_name":null,"insert_date":"2021-03-29T02:46:01.512Z","expiration_time":null,"mobile":"12312312312","account_lockout_time":null,"unsuccessful_login_attempts":10,"is_external":false,"qq_openid":null,"user_gid":"DEFAULT.20210001","version":0,"update_date":null,"force_password_reset":false,"account_unlock_time":null,"two_fa_secret_key":null,"auth_type_label":"db","user_xid":"20210001","role__role_name":"Guest Role","username":"zhangsan","default_role_gid":"DEFAULT.GUEST_ROLE","_TX_CODE":""},"originalData":{"effective_time":null,"pw_expiration_time":null,"dt_openid":null,"last_login_time":null,"activation_code":null,"dt_nickname":null,"insert_user":"DEFAULT.ADMIN","two_fa_enabled":false,"oidc_sub":null,"is_admin":false,"is_reserved":false,"domain_name":"DEFAULT","wx_openid":null,"update_user":null,"qq_nickname":null,"insert_user_common_name":null,"wx_nickname":null,"common_name":"张三","weixin_openid":null,"email":"123@qq.com","activation_state":true,"auth_type":"db","oidc_name":null,"insert_date":"2021-03-29T02:46:01.512Z","expiration_time":null,"mobile":"12312312312","account_lockout_time":null,"unsuccessful_login_attempts":10,"is_external":false,"qq_openid":null,"user_gid":"DEFAULT.20210001","version":0,"update_date":null,"force_password_reset":false,"account_unlock_time":null,"two_fa_secret_key":null,"auth_type_label":"db","user_xid":"20210001","role__role_name":"Guest Role","username":"zhangsan","default_role_gid":"DEFAULT.GUEST_ROLE","_TX_CODE":""}}],"aux":null}
\ No newline at end of file
{"selectedRows":[{"header":{"currentData":{"id":"","model1":"","model2":"","model3":"","code":"123456","refer_code":"123456","name":"张三","fullname":"","tel":"12312312312","email":"123@qq.com","username":"DEFAULT.张三","wx_open_id":"","sort_num":"","owner":null,"project":"","disabled":"","type":"","type_label":"","domain_name":"","version":"0","insert_user":"","insert_user_common_name":"","insert_date":"","update_user":"","update_user_common_name":"","update_date":"","staff_ext__country":null,"staff_ext__province":null,"staff_ext__city":null,"staff_ext__district":null,"staff_ext__town":null,"owner__code":null,"owner__name":null,"department__code":"","department__name":"","ext__id":"","ext__photo":"","ext__idcard":"","ext__idcard_pic1":"","ext__idcard_pic2":"","ext__idcard_expiry":"","ext__idcard_unit":"","ext__idcard_addr":"","ext__birthday":"2000-02-29T16:00:00.000Z","ext__gender":"M","ext__gender_label":"","ext__nationality":"","ext__job":"员工","ext__remark":"","ext__address":"","ext__domain_name":"","ext__insert_user":"","ext__insert_user_common_name":"","ext__insert_date":"","ext__update_user":"","ext__update_user_common_name":"","ext__update_date":"","hired__id":"","hired__company_code":null,"hired__department_code":"","hired__marital_status":"NO","hired__marital_status_label":"","hired__id_card":"321456789123456789","hired__family":"汉","hired__graduated_from":"成都大学","hired__education":"170","hired__education_label":"","hired__major":"网络工程","hired__graduated_date":"2014-03-11T16:00:00.000Z","hired__type":"100","hired__type_label":"","hired__status":"ZA","hired__status_label":"","hired__association":"无","hired__dingding_num":"11212121212","hired__weixin_num":"12312312312","hired__driver_license_num":"4567890456789","hired__driver_license_type":"C1","hired__driver_license_start_date":"2019-02-28T16:00:00.000Z","hired__driver_license_effective_date":"2026-03-29T16:00:00.000Z","hired__contract_no":"6543213435","hired__contract_start":"2020-02-29T16:00:00.000Z","hired__contract_end":"2027-03-29T16:00:00.000Z","hired__checkin_date":"","hired__start_work_date":"","hired__be_regular_date":"","hired__quit_date":"","hired__country_code":"100000","hired__province_code":"110000","hired__city_code":"110100","hired__district_code":"110101","hired__town_code":null,"hired__country":"中华人民共和国","hired__province":"北京市","hired__city":"北京市","hired__district":"东城区","hired__town":null,"hired__address":"","hired__disabled":false,"hired__remark":"","hired__dingding_id":"","hired__weixin_id":"","hired__domain_name":"","hired__insert_user":"","hired__insert_user_common_name":"","hired__insert_date":"","hired__update_user":"","hired__update_user_common_name":"","hired__update_date":"","_TX_CODE":""},"originalData":{"id":"","model1":"","model2":"","model3":"","code":"","refer_code":"","name":"","fullname":"","tel":"","email":"","username":"","wx_open_id":"","sort_num":"","owner":"","project":"","disabled":"","type":"","type_label":"","domain_name":"","version":"0","insert_user":"","insert_user_common_name":"","insert_date":"","update_user":"","update_user_common_name":"","update_date":"","staff_ext__country":"","staff_ext__province":"","staff_ext__city":"","staff_ext__district":"","staff_ext__town":"","owner__code":"","owner__name":"","department__code":"","department__name":"","ext__id":"","ext__photo":"","ext__idcard":"","ext__idcard_pic1":"","ext__idcard_pic2":"","ext__idcard_expiry":"","ext__idcard_unit":"","ext__idcard_addr":"","ext__birthday":"","ext__gender":"","ext__gender_label":"","ext__nationality":"","ext__job":"","ext__remark":"","ext__address":"","ext__domain_name":"","ext__insert_user":"","ext__insert_user_common_name":"","ext__insert_date":"","ext__update_user":"","ext__update_user_common_name":"","ext__update_date":"","hired__id":"","hired__company_code":"","hired__department_code":"","hired__marital_status":"","hired__marital_status_label":"","hired__id_card":"","hired__family":"","hired__graduated_from":"","hired__education":"","hired__education_label":"","hired__major":"","hired__graduated_date":"","hired__type":"","hired__type_label":"","hired__status":"","hired__status_label":"","hired__association":"","hired__dingding_num":"","hired__weixin_num":"","hired__driver_license_num":"","hired__driver_license_type":"","hired__driver_license_start_date":"","hired__driver_license_effective_date":"","hired__contract_no":"","hired__contract_start":"","hired__contract_end":"","hired__checkin_date":"","hired__start_work_date":"","hired__be_regular_date":"","hired__quit_date":"","hired__country_code":"","hired__province_code":"","hired__city_code":"","hired__district_code":"","hired__town_code":"","hired__country":"","hired__province":"","hired__city":"","hired__district":"","hired__town":"","hired__address":"","hired__disabled":false,"hired__remark":"","hired__dingding_id":"","hired__weixin_id":"","hired__domain_name":"","hired__insert_user":"","hired__insert_user_common_name":"","hired__insert_date":"","hired__update_user":"","hired__update_user_common_name":"","hired__update_date":"","_TX_CODE":""}},"accounts":{"rows":[{"currentData":{"_TX_CODE":"I","id":"","staff_num":"","user_gid":"DEFAULT.张三","domain_name":"","version":"0","insert_user":"","insert_user_common_name":"","insert_date":"","update_user":"","update_user_common_name":"","update_date":"","account__user_gid":"","account__user_xid":"","account__username":"张三","account__common_name":null},"originalData":{"_TX_CODE":"I","id":"","staff_num":"","user_gid":"","domain_name":"","version":"0","insert_user":"","insert_user_common_name":"","insert_date":"","update_user":"","update_user_common_name":"","update_date":"","account__user_gid":"","account__user_xid":"","account__username":"","account__common_name":""}}]}}],"aux":{"new":true}}
\ No newline at end of file
{"selectedRows":[{"header":{"currentData":{"id":"","warehouse_id":"292114446938148864","code":"10001","name":"茶园工厂外库混放规则","remark":"","enabled":true,"mix_owner":true,"mix_sku":true,"mix_pack":true,"mix_lot":true,"mix_sku_status":true,"mix_receive_time":true,"mix_produce_time":true,"mix_expire_time":true,"mix_supplier":true,"mix_asn_num":true,"mix_purchase_num":true,"mix_purchase_price":true,"mix_lot_attribute01":true,"mix_lot_attribute02":true,"mix_lot_attribute03":true,"mix_lot_attribute04":true,"mix_lot_attribute05":true,"mix_lot_attribute06":true,"mix_lot_attribute07":true,"mix_lot_attribute08":true,"mix_lot_attribute09":true,"mix_lot_attribute10":true,"mix_lot_attribute11":true,"mix_lot_attribute12":true,"mix_lot_attribute13":true,"mix_lot_attribute14":true,"mix_lot_attribute15":true,"mix_lot_attribute16":true,"mix_lot_attribute17":true,"mix_lot_attribute18":true,"mix_lot_attribute19":true,"mix_lot_attribute20":true,"domain_name":"","version":"0","insert_user":"","insert_user_common_name":"","insert_date":"","update_user":"","update_user_common_name":"","update_date":"","warehouse__code":"10001","warehouse__name":"茶园工厂外库","_TX_CODE":""},"originalData":{"id":"","warehouse_id":"","code":"","name":"","remark":"","enabled":true,"mix_owner":true,"mix_sku":true,"mix_pack":true,"mix_lot":true,"mix_sku_status":true,"mix_receive_time":true,"mix_produce_time":true,"mix_expire_time":true,"mix_supplier":true,"mix_asn_num":true,"mix_purchase_num":true,"mix_purchase_price":true,"mix_lot_attribute01":true,"mix_lot_attribute02":true,"mix_lot_attribute03":true,"mix_lot_attribute04":true,"mix_lot_attribute05":true,"mix_lot_attribute06":true,"mix_lot_attribute07":true,"mix_lot_attribute08":true,"mix_lot_attribute09":true,"mix_lot_attribute10":true,"mix_lot_attribute11":true,"mix_lot_attribute12":true,"mix_lot_attribute13":true,"mix_lot_attribute14":true,"mix_lot_attribute15":true,"mix_lot_attribute16":true,"mix_lot_attribute17":true,"mix_lot_attribute18":true,"mix_lot_attribute19":true,"mix_lot_attribute20":true,"domain_name":"","version":"0","insert_user":"","insert_user_common_name":"","insert_date":"","update_user":"","update_user_common_name":"","update_date":"","warehouse__code":"","warehouse__name":"","_TX_CODE":""}}}],"aux":{"new":true}}
\ No newline at end of file
{"selectedRows":[{"header":{"currentData":{"id":"","warehouse_id":"292114446938148864","code":"123213","name":"213123","remark":"","enabled":true,"domain_name":"","version":"0","insert_user":"","insert_user_common_name":"","insert_date":"","update_user":"","update_user_common_name":"","update_date":"","warehouse__code":"10001","warehouse__name":"茶园工厂外库","_TX_CODE":""},"originalData":{"id":"","warehouse_id":"","code":"","name":"","remark":"","enabled":true,"domain_name":"","version":"0","insert_user":"","insert_user_common_name":"","insert_date":"","update_user":"","update_user_common_name":"","update_date":"","warehouse__code":"","warehouse__name":"","_TX_CODE":""}},"lines":{"rows":[]}}],"aux":{"new":true}}
\ No newline at end of file
{"selectedRows":[{"header":{"currentData":{"id":"","warehouse_id":"292114446938148864","code":"31342","name":"213412","remark":"","enabled":true,"domain_name":"","version":"0","insert_user":"","insert_user_common_name":"","insert_date":"","update_user":"","update_user_common_name":"","update_date":"","warehouse__code":"10001","warehouse__name":"茶园工厂外库","_TX_CODE":""},"originalData":{"id":"","warehouse_id":"","code":"","name":"","remark":"","enabled":true,"domain_name":"","version":"0","insert_user":"","insert_user_common_name":"","insert_date":"","update_user":"","update_user_common_name":"","update_date":"","warehouse__code":"","warehouse__name":"","_TX_CODE":""}}}],"aux":{"new":true}}
\ No newline at end of file
{"selectedRows":[{"header":{"currentData":{"id":"","warehouse_id":"292114446938148864","code":"12","name":"1212","remark":"","enabled":true,"domain_name":"","version":"0","insert_user":"","insert_user_common_name":"","insert_date":"","update_user":"","update_user_common_name":"","update_date":"","warehouse__code":"10001","warehouse__name":"茶园工厂外库","_TX_CODE":""},"originalData":{"id":"","warehouse_id":"","code":"","name":"","remark":"","enabled":true,"domain_name":"","version":"0","insert_user":"","insert_user_common_name":"","insert_date":"","update_user":"","update_user_common_name":"","update_date":"","warehouse__code":"","warehouse__name":"","_TX_CODE":""}},"lines":{"rows":[]}}],"aux":{"new":true}}
\ No newline at end of file
{"selectedRows":[{"header":{"currentData":{"id":"","warehouse_id":"292114446938148864","code":"11111","name":"11111","remark":"","enabled":true,"domain_name":"","version":"0","insert_user":"","insert_user_common_name":"","insert_date":"","update_user":"","update_user_common_name":"","update_date":"","warehouse__code":"10001","warehouse__name":"茶园工厂外库","_TX_CODE":""},"originalData":{"id":"","warehouse_id":"","code":"","name":"","remark":"","enabled":true,"domain_name":"","version":"0","insert_user":"","insert_user_common_name":"","insert_date":"","update_user":"","update_user_common_name":"","update_date":"","warehouse__code":"","warehouse__name":"","_TX_CODE":""}},"lines":{"rows":[]}}],"aux":{"new":true}}
\ No newline at end of file
{"test":"test"}
\ No newline at end of file
{"selectedRows":[{"header":{"currentData":{"id":"","warehouse_id":"292114446938148864","code":"678678","name":"规则","remark":"","enabled":true,"domain_name":"","version":"0","insert_user":"","insert_user_common_name":"","insert_date":"","update_user":"","update_user_common_name":"","update_date":"","warehouse__code":"10001","warehouse__name":"茶园工厂外库","_TX_CODE":""},"originalData":{"id":"","warehouse_id":"","code":"","name":"","remark":"","enabled":true,"domain_name":"","version":"0","insert_user":"","insert_user_common_name":"","insert_date":"","update_user":"","update_user_common_name":"","update_date":"","warehouse__code":"","warehouse__name":"","_TX_CODE":""}},"lines":{"rows":[]}}],"aux":{"new":true}}
\ No newline at end of file
{"selectedRows":[{"header":{"currentData":{"id":"","warehouse_id":"292114446938148864","code":"123123","name":"213213","remark":"","enabled":true,"domain_name":"","version":"0","insert_user":"","insert_user_common_name":"","insert_date":"","update_user":"","update_user_common_name":"","update_date":"","warehouse__code":"10001","warehouse__name":"茶园工厂外库","_TX_CODE":""},"originalData":{"id":"","warehouse_id":"","code":"","name":"","remark":"","enabled":true,"domain_name":"","version":"0","insert_user":"","insert_user_common_name":"","insert_date":"","update_user":"","update_user_common_name":"","update_date":"","warehouse__code":"","warehouse__name":"","_TX_CODE":""}}}],"aux":{"new":true}}
\ No newline at end of file
"""
支持用例编写的另一种方式--相较于excel,使用py文件编写用例,可用python相关的一些方法来制造数据,更加灵活
"""
import random
from base.setting import setting
whid =setting.warehouse_rule['warehouse_name']
ruleid = whid + '预分配规则'
# 接口用例合集
API = [
{'name': 'make_kuwei', 'priority': '1',
'api_address': 'api/query/w_location/action/commonSave',
'save_field': '', 'method': 'post',
'request_data': 'F=make_kuwei1.json', 'expected': {"messageType": "success"},
'assert_method': 'include_json'},
{'name': 'make_user', 'priority': '1',
'api_address': 'api/query/userQuery/action/userPageAccountDataSet',
'save_field': '', 'method': 'post',
'request_data': 'F=make_user.json', 'expected': {"messageType": "success"},
'assert_method': 'include_json'},
{'name': 'make_user2', 'priority': '1',
'api_address': 'api/query/staff/action/commonSave',
'save_field': '', 'method': 'post',
'request_data': 'F=make_user2.json', 'expected': {"messageType": "success"},
'assert_method': 'include_json'},
]
# 场景用例
SCENE = [{'name': [i['name'] for i in API],
'scene_case': ['make_kuwei','make_kuwei','make_kuwei','make_kuwei','make_kuwei','make_kuwei','make_kuwei','make_kuwei'], 'priority': '', 'is_run': '1', 'case_pass': ''},
]
#[i['name'] for i in API]
if __name__ == '__main__':
print('re_allocation_id=$.data.header[?(@.name=="{}")].id'.format(ruleid))
\ No newline at end of file
This diff is collapsed.
{
"testPass": 0,
"testResult": [
{
"CaseName": "test_template",
"api": "test_errors_save_imgs",
"parameter": "parameter",
"result": "result",
"status": "失败",
"log": null
}
],
"testName": "测试deafult报告",
"testAll": 1,
"testFail": 1,
"beginTime": "2018-01-26 16:12:03",
"totalTime": "18s",
"testSkip": 0,
"testError": 0
}
\ No newline at end of file
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
import requests
import json
# Header = {
# 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36',
# 'Content-Type': 'application/json;charset=UTF-8',
# 'Cookie': '_t_logwire=eyJhbGciOiJIUzUxMiJ9.eyJleHQiOm51bGwsInN1YiI6IkRFRkFVTFQuQURNSU4iLCJ0b3RwIjoiIiwiYXVkaWVuY2UiOiJ3ZWIiLCJjcmVhdGVkIjoxNjExNzI0NjE0MDUxLCJyb2xlcyI6WyJERUZBVUxULkFETUlOX1JPTEUiXSwiYWRtaW4iOnRydWUsInNlc3Npb25JZCI6ImJlM2Y1MmViLTljNzQtNDNlNy1hMjMwLTk2NmIyZTM1NmNmNSIsImZvcmNlUGFzc3dvcmRSZXNldCI6ZmFsc2UsImNvbW1vbiI6ImhlbGxvIiwiZG9tYWluIjoiREVGQVVMVCIsImV4cCI6MTYxMTc2MDYxNCwidGVuYW50Ijoid21zIiwiZnVsbCI6IkFETUlOIn0.IL4tRQD-hicYKcsM34EhIQn6BGWhRhvc4I0IaV30jroZqNyzkLZS4lZvEuzQRRaGHz2YQC34P3KVdTiKodRXZg',
# }
# datas = {"selectedRows":[{"header":{"currentData":{"id":"","model1":"","model2":"","model3":"","code":"H-1-1-002","refer_code":"H-1-1-002","name":"H-1-1-002","address":"274133627011469312","door":"","parent":"274362567319752704","truck":"","qty":"","avl_qty":"","length":1,"width":1,"height":1,"longitude":"","latitude":"","gps_fence":"","wx_fence":"","truck_type":"","capacity_type":"volume","capacity_type_label":"","load_capacity":"","unload_capacity":"","static_minute":"","sort_num":"","detail":"","recognition":"","barrier":"","bulletin":"","speaker":"","parent2":"274363078269865984","roadway":"","storage_type":"","storage_type_label":"","shelf_type":"","shelf_type_label":"","x_coordinate":"","y_coordinate":"","z_coordinate":"","x_coordinate2":"","y_coordinate2":"","z_coordinate2":"","bays":"","bay_length":"","bay_space":"","heap_lines":"","heap_tiers":"","row":"","column":"","layer":"","layer_count":"","abc_type":"","abc_type_label":"","line_order":"","line_order2":"","line_order3":"","floor":"","volume":"","ground_pallet_count":"","stack_limit":"","pack_handle_type":"","pack_handle_type_label":"","lose_id":False,"mix_rule_id":"","zone_row_mix_rule_id":"","zone_col_mix_rule_id":"","mix_rule_name":"","zone_row_mix_rule_name":"","zone_col_mix_rule_name":"","storage_condition":"","storage_condition_label":"","sku_form_types":[],"sku_form_types_label":"","section_type":"OTHER","section_type_label":"","enabled":True,"domain_name":"","version":"0","insert_user":"","insert_user_common_name":"","insert_date":"","update_user":"","update_user_common_name":"","update_date":"","warehouse__code":"GBLGZ","warehouse__name":"GBL 广州中心仓库","section__code":"","section__name":"","section__section_type":"","section__section_type_label":"","zone__code":"2","zone__name":"存储库区","roadway__code":"","roadway__name":"","_TX_CODE":""},"originalData":{"id":"","model1":"","model2":"","model3":"","code":"","refer_code":"","name":"","address":"","door":"","parent":"","truck":"","qty":"","avl_qty":"","length":"","width":"","height":"","longitude":"","latitude":"","gps_fence":"","wx_fence":"","truck_type":"","capacity_type":"volume","capacity_type_label":"","load_capacity":"","unload_capacity":"","static_minute":"","sort_num":"","detail":"","recognition":"","barrier":"","bulletin":"","speaker":"","parent2":"","roadway":"","storage_type":"","storage_type_label":"","shelf_type":"","shelf_type_label":"","x_coordinate":"","y_coordinate":"","z_coordinate":"","x_coordinate2":"","y_coordinate2":"","z_coordinate2":"","bays":"","bay_length":"","bay_space":"","heap_lines":"","heap_tiers":"","row":"","column":"","layer":"","layer_count":"","abc_type":"","abc_type_label":"","line_order":"","line_order2":"","line_order3":"","floor":"","volume":"","ground_pallet_count":"","stack_limit":"","pack_handle_type":"","pack_handle_type_label":"","lose_id":False,"mix_rule_id":"","zone_row_mix_rule_id":"","zone_col_mix_rule_id":"","mix_rule_name":"","zone_row_mix_rule_name":"","zone_col_mix_rule_name":"","storage_condition":"","storage_condition_label":"","sku_form_types":"","sku_form_types_label":"","section_type":"","section_type_label":"","enabled":True,"domain_name":"","version":"0","insert_user":"","insert_user_common_name":"","insert_date":"","update_user":"","update_user_common_name":"","update_date":"","warehouse__code":"","warehouse__name":"","section__code":"","section__name":"","section__section_type":"","section__section_type_label":"","zone__code":"","zone__name":"","roadway__code":"","roadway__name":"","_TX_CODE":""}}}],"aux":{"new":True}}
#
# res = requests.get('http://119.3.73.53:18082/api/notification/summary', headers=Header)
# res1 = requests.post('http://119.3.73.53:18082/api/query/w_location/action/commonSave',headers=Header,data=json.dumps(datas))
# print(res.text)
# print(res1.text)
def assert_json(exp, act):
if isinstance(exp, str) and isinstance(act, str):
if exp == act:
print('-------------------', exp, act)
return True
elif isinstance(exp, dict):
for j in exp.keys():
if j in act:
return assert_json(exp[j], act[j])
elif isinstance(exp, list):
for i in exp:
for k in act:
return assert_json(i, k)
import jsonpath
a = {'code': 'none', 'message': None, 'messageCode': None, 'messageArgs': None, 'messageType': 'success',
'exception': None, 'traceId': None, 'stackTrace': None, 'data': {
'header': {'est_arrival_time': '', 'carrier_driver': '', 'supplier_address': '',
'owner_id': '274133961150697472', 'carrier_contact': '', 'supplier__name': '', 'carrier_phone': '',
'order_time': '2021-01-28T06:51:15.103Z', 'type': '103', 'supplier_contact': '',
'carrier_address': '', 'domain_name': 'DEFAULT', 'insert_user_common_name': '',
'end_receive_time': '', '_TX_CODE': 'U', 'supplier_phone': '', 'id': '274793497062674432',
'type_label': '', 'supplier__code': '', 'carrier_trailer_num': '',
'insert_date': '2021-01-28T06:51:15.114Z', 'dock_end_time': '', 'priority': '1', 'version': 0,
'ext_no': '', 'qty': 2, 'carrier_driver_phone': '', 'supplier_id': '', 'supplier_code': '',
'carrier__code': '', 'owner__name': 'GRT 广汽乘用车', 'actual_arrival_time': '', 'remark': '',
'insert_user': 'DEFAULT.ADMIN', 'carrier_id': '', 'warehouse__code': 'GBLGZ', 'owner__code': 'GRT',
'dock_id': '', 'supplier_name': '', 'carrier_name': '', 'come_from_label': '', 'come_from': 'WMS',
'carrier_plate_num': '', 'carrier__name': '', 'dock__name': '', 'asn_no': 'A20210128-0038',
'warehouse__name': 'GBL 广州中心仓库', 'bill_status': '100', 'bill_status_label': '',
'update_user_common_name': '', 'dock__code': '', 'dock_start_time': '', 'carrier_waybill_num': '',
'start_receive_time': '', 'warehouse_id': '274133627011469312', 'receive_qty': 0,
'carrier_code': ''}, 'lines': {'rows': [
{'owner_id': '274133961150697472', 'pack__case_qty': None, 'pack__case_code': 'CS', 'ext_line_no': '',
'location_id': '', 'uom': 'EA', 'domain_name': 'DEFAULT', 'insert_user_common_name': '', '_TX_CODE': 'U',
'supplier': '', 'uom_base_qty': 1, 'id': '274793497108811776', 'pack__each_code': 'EA',
'lot_attribute01': '', 'insert_date': '2021-01-28T06:51:15.126Z', 'receive_time': '', 'expire_time': '',
'sku_id': '274350588081344512', 'pack__inner_qty': 2, 'produce_time': '', 'version': 0,
'pack__name': '24缸发动机包装', 'asn_id': '274793497062674432', 'sku__code': '1', 'inventory_lot__lot': '',
'qty': 2, 'pack__each_qty': 1, 'purchase_price': '', 'lot_attribute08': '', 'lot_attribute09': '',
'lot_attribute06': '', 'lot_attribute07': '', 'lot_attribute04': '', 'case_num': '', 'lot_attribute05': '',
'lot_attribute02': '', 'lot_attribute03': '', 'lot_attribute11': '', 'lot_attribute12': '',
'pack__code': '001', 'lot_attribute10': '', 'uom_qty': 2, 'inventory_lot_id': '', 'remark': '',
'insert_user': 'DEFAULT.ADMIN', 'location__name': '', 'purchase_num': '', 'sku__name': '24缸发动机',
'lot_attribute19': '', 'lot_attribute17': '', 'lot_attribute18': '', 'lot_attribute15': '',
'lot_attribute16': '', 'lot_attribute13': '', 'lot_attribute14': '', 'lot_attribute20': '',
'pack_id': '274350959067533312', 'line_no': 'AL20210128-0038', 'location__code': '',
'asn_no': 'A20210128-0038', 'lpn': '', 'sku_status': '', 'bill_status': '100', 'bill_status_label': '',
'update_user_common_name': '', 'pack__pallet_qty': None, 'pack__pallet_code': 'PL', 'asn_num': '',
'sort_num': 0, 'pack__inner_code': 'IP', 'warehouse_id': '274133627011469312', 'receive_qty': ''}]}},
'qa': None, 'question': None,
'renewedToken': 'eyJhbGciOiJIUzUxMiJ9.eyJleHQiOm51bGwsInN1YiI6IkRFRkFVTFQuQURNSU4iLCJ0b3RwIjoiIiwiYXVkaWVuY2UiOiJ3ZWIiLCJjcmVhdGVkIjoxNjExODE2Njc1MTQwLCJyb2xlcyI6WyJERUZBVUxULkFETUlOX1JPTEUiXSwiYWRtaW4iOnRydWUsInNlc3Npb25JZCI6ImZkOTA4ODE1LTA5YTctNGI5Yi05N2E1LTVhYTU5OTZjOWFjMiIsImZvcmNlUGFzc3dvcmRSZXNldCI6ZmFsc2UsImNvbW1vbiI6ImhlbGxvIiwiZG9tYWluIjoiREVGQVVMVCIsImV4cCI6MTYxMTg1MjY3NSwidGVuYW50Ijoid21zIiwiZnVsbCI6IkFETUlOIn0.CqqMwZ0dBfdkEsYfKpAC9yw-IBcVxozRJ3MDKHvpLe_ulhs9IsFNUo2LPzGd3WKUWzA2KCEIFuLC6HVsVlAXzg',
'duration': False, 'messageDurative': False, 'deferMillis': 0, 'objectDescription': None}
if __name__ == '__main__':
print(jsonpath.jsonpath(a, '$.data'))
print(['2', None, False])
print({False: ''})
import pytest
import robot
s1 = "abcd"
s2 = "acdb"
def changeChar(s1, s2):
lst_s1 = list(s1)
print(lst_s1)
lst_s2 = list(s2)
print(lst_s2)
lst_s2.insert(1, lst_s2.pop(-1))
print(lst_s2)
return True if lst_s1 == lst_s2 else False
if __name__ == "__main__":
c = changeChar(s1, s2)
print(c)
This diff is collapsed.
This diff is collapsed.
{
'selectedRows': [
{
'header': {
'currentData': {
'id': '',
'model1': '',
'model2': '',
'model3': '',
'code': 'A1-A4-2-100',
'refer_code': 'A1-A4-2-100',
'name': 'A1-A4-2-100',
'address': '293329199773646848',
'door': '',
'parent': '293332980317945856',
'truck': '',
'qty': '',
'avl_qty': '',
'length': 1000,
'width': 1000,
'height': 500,
'longitude': '',
'latitude': '',
'gps_fence': '',
'wx_fence': '',
'truck_type': '',
'capacity_type': 'volume',
'capacity_type_label': '',
'load_capacity': '',
'unload_capacity': '',
'static_minute': '',
'sort_num': '',
'detail': '',
'recognition': '',
'barrier': '',
'bulletin': '',
'speaker': '',
'parent2': '293333187927605248',
'roadway': '293331476613824512',
'storage_type': 'STORAGE',
'storage_type_label': '',
'shelf_type': '',
'shelf_type_label': '',
'x_coordinate': '0',
'y_coordinate': '7200',
'z_coordinate': '1000',
'x_coordinate2': '',
'y_coordinate2': '',
'z_coordinate2': '',
'bays': '',
'bay_length': '',
'bay_space': '',
'heap_lines': '',
'heap_tiers': '',
'row': '',
'column': '',
'layer': '',
'layer_count': '',
'abc_type': '',
'abc_type_label': '',
'line_order': '',
'line_order2': '',
'line_order3': '',
'floor': '',
'volume': '',
'ground_pallet_count': '',
'stack_limit': '',
'pack_handle_type': '',
'pack_handle_type_label': '',
'lose_id': False,
'mix_rule_id': '',
'zone_row_mix_rule_id': '',
'zone_col_mix_rule_id': '',
'mix_rule_name': '',
'zone_row_mix_rule_name': '',
'zone_col_mix_rule_name': '',
'storage_condition': '',
'storage_condition_label': '',
'sku_form_types': [],
'sku_form_types_label': '',
'section_type': 'OTHER',
'section_type_label': '',
'enabled': True,
'description': '',
'effective_date': '',
'expiration_date': '',
'dock_type': '',
'dock_type_label': '',
'gateway_type': '',
'gateway_type_label': '',
'operation_interval': '',
'berthing_time': '',
'rule': '',
'calendar': '',
'is_auto': False,
'is_open': True,
'zone': '',
'lot_type': '',
'lot_type_label': '',
'hight_low_type': '',
'hight_low_type_label': '',
'w_zone_type': '',
'w_zone_type_label': '',
'w_location_type': '',
'w_location_type_label': '',
'roadway_in_location_id': '',
'roadway_out_location_id': '',
'zone_stage_location_id': '',
'domain_name': '',
'version': '0',
'insert_user': '',
'insert_user_common_name': '',
'insert_date': '',
'update_user': '',
'update_user_common_name': '',
'update_date': '',
'warehouse__code': 'GQC-广汽中心仓',
'warehouse__name': 'GQC-广汽中心仓',
'section__code': '',
'section__name': '',
'section__section_type': '',
'section__section_type_label': '',
'zone__code': 'GQ-KQ-A-100',
'zone__name': 'GQ-KQ-A-100',
'roadway__code': 'GQ-XD-100',
'roadway__name': 'GQ-XD-100',
'_TX_CODE': ''
},
'originalData': {
'id': '',
'model1': '',
'model2': '',
'model3': '',
'code': '',
'refer_code': '',
'name': '',
'address': '',
'door': '',
'parent': '',
'truck': '',
'qty': '',
'avl_qty': '',
'length': '',
'width': '',
'height': '',
'longitude': '',
'latitude': '',
'gps_fence': '',
'wx_fence': '',
'truck_type': '',
'capacity_type': 'volume',
'capacity_type_label': '',
'load_capacity': '',
'unload_capacity': '',
'static_minute': '',
'sort_num': '',
'detail': '',
'recognition': '',
'barrier': '',
'bulletin': '',
'speaker': '',
'parent2': '',
'roadway': '',
'storage_type': '',
'storage_type_label': '',
'shelf_type': '',
'shelf_type_label': '',
'x_coordinate': '',
'y_coordinate': '',
'z_coordinate': '',
'x_coordinate2': '',
'y_coordinate2': '',
'z_coordinate2': '',
'bays': '',
'bay_length': '',
'bay_space': '',
'heap_lines': '',
'heap_tiers': '',
'row': '',
'column': '',
'layer': '',
'layer_count': '',
'abc_type': '',
'abc_type_label': '',
'line_order': '',
'line_order2': '',
'line_order3': '',
'floor': '',
'volume': '',
'ground_pallet_count': '',
'stack_limit': '',
'pack_handle_type': '',
'pack_handle_type_label': '',
'lose_id': False,
'mix_rule_id': '',
'zone_row_mix_rule_id': '',
'zone_col_mix_rule_id': '',
'mix_rule_name': '',
'zone_row_mix_rule_name': '',
'zone_col_mix_rule_name': '',
'storage_condition': '',
'storage_condition_label': '',
'sku_form_types': '',
'sku_form_types_label': '',
'section_type': '',
'section_type_label': '',
'enabled': True,
'description': '',
'effective_date': '',
'expiration_date': '',
'dock_type': '',
'dock_type_label': '',
'gateway_type': '',
'gateway_type_label': '',
'operation_interval': '',
'berthing_time': '',
'rule': '',
'calendar': '',
'is_auto': False,
'is_open': True,
'zone': '',
'lot_type': '',
'lot_type_label': '',
'hight_low_type': '',
'hight_low_type_label': '',
'w_zone_type': '',
'w_zone_type_label': '',
'w_location_type': '',
'w_location_type_label': '',
'roadway_in_location_id': '',
'roadway_out_location_id': '',
'zone_stage_location_id': '',
'domain_name': '',
'version': '0',
'insert_user': '',
'insert_user_common_name': '',
'insert_date': '',
'update_user': '',
'update_user_common_name': '',
'update_date': '',
'warehouse__code': '',
'warehouse__name': '',
'section__code': '',
'section__name': '',
'section__section_type': '',
'section__section_type_label': '',
'zone__code': '',
'zone__name': '',
'roadway__code': '',
'roadway__name': '',
'_TX_CODE': ''
}
}
}
],
'aux': {
'new': True
}
}
\ No newline at end of file
# Default ignored files
/shelf/
/workspace.xml
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (ez_-test)" project-jdk-type="Python SDK" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/user_custom.iml" filepath="$PROJECT_DIR$/.idea/user_custom.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>
\ No newline at end of file
A1-A4-2-100
0
0
0
\ No newline at end of file
"""
执行时需要继承Testunner这个类
不允许重载__init__函数
"""
from base.case_runner import TestRunner
from base.case_runner import excel_driver
from base import loginfo
@excel_driver('../data/template_testcase.xlsx')
class GQTest(TestRunner):
# 重写用例执行前的方法
def before_parameter(self, case, mid_res):
"""
case--用例对象,可以通过case.name,或者request_data等这里的属性与excel中的属性保持一致
"""
import time
time.sleep(20)
loginfo.debug('\033[32m测试用例执行前的处理\033[0m')
def after_parameter(self, case):
loginfo.debug('\033[32m用例执行后数据处理 {}\033[0m'.format(case.actual))
if __name__ == '__main__':
GQTest().run_test()
"""
执行时需要继承Testunner这个类
不允许重载__init__函数
"""
from base.case_runner import TestRunner
from base.case_runner import py_driver
from base import loginfo
from data.template_casedata import *
from base.setting import setting
def read_data(path):
with open(path, 'r', encoding='utf-8') as fp:
return fp.read().split('\n')
def write_data(path, data):
with open(path, 'w', encoding='utf-8') as fp:
fp.write(data)
@py_driver(api_case=API, scene_case=SCENE)
class GQTest(TestRunner):
def before_parameter(self, case, mid_res):
if case.name == 'make_kuwei':
self.create_3dlocation_test(case, mid_res)
# 创建3D库位测试用
def create_3dlocation_test(self,case, mid_res):
info = read_data('./data.txt')
# 代码--参考代码,名称保持一致
code = 'A1-A5-2-105'
x = '1200'
y = '8400'
z = '1000'
# 库区信息
# zone__code = '8000'
# zone__name = '原料库区'
# parent2 = '292945353773289472'
case.request_data['selectedRows'][0]['header']['currentData']['code'] = code
case.request_data['selectedRows'][0]['header']['currentData']['name'] = code
case.request_data['selectedRows'][0]['header']['currentData']['refer_code'] = code
case.request_data['selectedRows'][0]['header']['currentData']['x_coordinate'] = x
case.request_data['selectedRows'][0]['header']['currentData']['y_coordinate'] = y
case.request_data['selectedRows'][0]['header']['currentData']['z_coordinate'] = z
# case.request_data['selectedRows'][0]['header']['currentData']['zone__code'] = zone__code
# case.request_data['selectedRows'][0]['header']['currentData']['zone__name'] = zone__name
# case.request_data['selectedRows'][0]['header']['currentData']['parent2'] = parent2
mid_res['data_test'] = [code, x, y, z]
def after_parameter(self, case, mid_res):
print('678987656789')
for i in range(1, 9):
mid_res['data_test'][0] = 'A1-A4-2-10{}'.format(i)
mid_res['data_test'][1] = str(i*1200)
# mid_res['data_test'][2] = ''
# mid_res['data_test'][3] = ''
yield mid_res
loginfo.debug('\033[32m用例执行后数据处理 {}\033[0m'.format(case.actual))
if __name__ == '__main__':
GQTest().run_test()
# a = read_data('./data.txt')
# print(a)
\ No newline at end of file
"""
执行时需要继承Testunner这个类
不允许重载__init__函数
"""
from base.case_runner import TestRunner
from base.case_runner import py_driver
from base import loginfo
from data.template_casedata import *
from base.setting import setting
@py_driver(api_case=API, scene_case=SCENE)
class GQTest(TestRunner):
# 重写用例执行前的方法
def before_parameter(self, case, mid_res):
"""
case--用例对象,可以通过case.name,或者request_data等这里的属性与excel中的属性保持一致
"""
name = setting.warehouse_rule['warehouse_name']
code = setting.warehouse_rule['warehouse_code']
if case.name == 'batch_rule':
case.request_data['selectedRows'][0]['header']['currentData']['warehouse__name'] = name
case.request_data['selectedRows'][0]['header']['currentData']['code'] = code
case.request_data['selectedRows'][0]['header']['currentData']['name'] = name + '批次规则'
case.request_data['selectedRows'][0]['header']['currentData']['warehouse__code'] = code
case.request_data['selectedRows'][0]['header']['currentData']['warehouse_id'] = mid_res['id']
elif case.name == 'mixing_rule':
case.request_data['selectedRows'][0]['header']['currentData']['warehouse__name'] = name
case.request_data['selectedRows'][0]['header']['currentData']['code'] = code
case.request_data['selectedRows'][0]['header']['currentData']['name'] = name + '波段规则'
case.request_data['selectedRows'][0]['header']['currentData']['warehouse__code'] = code
case.request_data['selectedRows'][0]['header']['currentData']['warehouse_id'] = mid_res['id']
elif case.name == 'receiving_verification_rule':
case.request_data['selectedRows'][0]['header']['currentData']['warehouse__name'] = name
case.request_data['selectedRows'][0]['header']['currentData']['code'] = code
case.request_data['selectedRows'][0]['header']['currentData']['name'] = name + '发货验证规则'
case.request_data['selectedRows'][0]['header']['currentData']['warehouse__code'] = code
case.request_data['selectedRows'][0]['header']['currentData']['warehouse_id'] = mid_res['id']
elif case.name == 'turnover_rule':
case.request_data['selectedRows'][0]['header']['currentData']['warehouse__name'] = name
case.request_data['selectedRows'][0]['header']['currentData']['code'] = code
case.request_data['selectedRows'][0]['header']['currentData']['name'] = name + '周转规则'
case.request_data['selectedRows'][0]['header']['currentData']['warehouse__code'] = code
case.request_data['selectedRows'][0]['header']['currentData']['warehouse_id'] = mid_res['id']
elif case.name == 'listing_rule':
case.request_data['selectedRows'][0]['header']['currentData']['warehouse__name'] = name
case.request_data['selectedRows'][0]['header']['currentData']['code'] = code
case.request_data['selectedRows'][0]['header']['currentData']['name'] = name + '上架规则'
case.request_data['selectedRows'][0]['header']['currentData']['warehouse__code'] = code
case.request_data['selectedRows'][0]['header']['currentData']['warehouse_id'] = mid_res['id']
# elif case.name == 'listing_rule_s':
# case.request_data['data']['header']['id'] = name
# case.request_data['data']['header']['rotate__code'] = code
# case.request_data['data']['header']['warehouse__code'] = mid_res['id']
# case.request_data['data']['header']['putaway__name'] = name
# case.request_data['data']['header']['rotate__name'] = name
# case.request_data['data']['header']['rule_id'] = name
# case.request_data['data']['header']['warehouse_id'] = name
# case.request_data['data']['header']['rotate_rule_id'] = name
# case.request_data['data']['header']['warehouse__name'] = name
elif case.name == 'pre_allocation_rule':
case.request_data['selectedRows'][0]['header']['currentData']['warehouse__name'] = name
case.request_data['selectedRows'][0]['header']['currentData']['code'] = code
case.request_data['selectedRows'][0]['header']['currentData']['name'] = name + '预分配规则'
case.request_data['selectedRows'][0]['header']['currentData']['warehouse__code'] = code
case.request_data['selectedRows'][0]['header']['currentData']['warehouse_id'] = mid_res['id']
elif case.name == 'allocation_rule':
case.request_data['selectedRows'][0]['header']['currentData']['warehouse__name'] = name
case.request_data['selectedRows'][0]['header']['currentData']['code'] = code
case.request_data['selectedRows'][0]['header']['currentData']['name'] = name + '分配规则'
case.request_data['selectedRows'][0]['header']['currentData']['warehouse__code'] = code
case.request_data['selectedRows'][0]['header']['currentData']['warehouse_id'] = mid_res['id']
case.request_data['selectedRows'][0]['header']['currentData']['preallocate__name'] = name + '预分配规则'
case.request_data['selectedRows'][0]['header']['currentData']['preallocate_rule_id'] = mid_res['pre_allocation_id']
case.request_data['selectedRows'][0]['header']['currentData']['preallocate__code'] = code
elif case.name == 'cutbox_rule':
case.request_data['selectedRows'][0]['header']['currentData']['warehouse__name'] = name
case.request_data['selectedRows'][0]['header']['currentData']['code'] = code
case.request_data['selectedRows'][0]['header']['currentData']['name'] = name + '切分规则'
case.request_data['selectedRows'][0]['header']['currentData']['warehouse__code'] = code
case.request_data['selectedRows'][0]['header']['currentData']['warehouse_id'] = mid_res['id']
elif case.name == 'wave_rule':
case.request_data['selectedRows'][0]['header']['currentData']['warehouse__name'] = name
case.request_data['selectedRows'][0]['header']['currentData']['code'] = code
case.request_data['selectedRows'][0]['header']['currentData']['name'] = name + '波次规则'
case.request_data['selectedRows'][0]['header']['currentData']['warehouse__code'] = code
case.request_data['selectedRows'][0]['header']['currentData']['warehouse_id'] = mid_res['id']
elif case.name == 'pick_order_rule':
case.request_data['selectedRows'][0]['header']['currentData']['warehouse__name'] = name
case.request_data['selectedRows'][0]['header']['currentData']['code'] = code
case.request_data['selectedRows'][0]['header']['currentData']['name'] = name + '拣选单规则'
case.request_data['selectedRows'][0]['header']['currentData']['warehouse__code'] = code
case.request_data['selectedRows'][0]['header']['currentData']['warehouse_id'] = mid_res['id']
elif case.name == 'out_validation_rule':
case.request_data['selectedRows'][0]['header']['currentData']['warehouse__name'] = name
case.request_data['selectedRows'][0]['header']['currentData']['code'] = code
case.request_data['selectedRows'][0]['header']['currentData']['name'] = name + '拣选单规则'
case.request_data['selectedRows'][0]['header']['currentData']['warehouse__code'] = code
case.request_data['selectedRows'][0]['header']['currentData']['warehouse_id'] = mid_res['id']
loginfo.debug('\033[32m测试用例执行前的处理\033[0m')
def after_parameter(self, case):
loginfo.debug('\033[32m用例执行后数据处理 {}\033[0m'.format(case.actual))
if __name__ == '__main__':
GQTest().run_test()
"""
执行时需要继承Testunner这个类
不允许重载__init__函数
"""
from base.case_runner import TestRunner
from base.case_runner import py_driver
from base import loginfo
from data.template_casedata import *
from base.setting import setting
@py_driver(api_case=API, scene_case=SCENE)
class GQTest(TestRunner):
def before_parameter(self, case, mid_res):
if case.name == 'make_user':
self.create_initialization(case, mid_res)
if case.name == 'make_user_read':
self.create_initialization(case, mid_res)
# 初始化数据使用
def create_initialization(self,case, mid_res):
name = setting.user_name['user_name']
xid = setting.user_name['name_xid']
case.request_data['selectedRows'][0]['currentData']['username'] = name
case.request_data['selectedRows'][0]['currentData']['user_xid'] = xid
def after_parameter(self, case, mid_res):
loginfo.debug('\033[32m用例执行后数据处理 {}\033[0m'.format(case.actual))
if __name__ == '__main__':
GQTest().run_test()
# a = read_data('./data.txt')
# print(a)
\ No newline at end of file
"""
执行时需要继承Testunner这个类
不允许重载__init__函数
"""
from base.case_runner import TestRunner
from base.case_runner import py_driver
from base import loginfo
from data.template_casedata import *
@py_driver(api_case=API, scene_case=SCENE)
class GQTest(TestRunner):
# 重写用例执行前的方法
def before_parameter(self, case, mid_res):
"""
case--用例对象,可以通过case.name,或者request_data等这里的属性与excel中的属性保持一致
"""
loginfo.debug('\033[32m测试用例执行前的处理\033[0m')
def after_parameter(self, case):
loginfo.debug('\033[32m用例执行后数据处理 {}\033[0m'.format(case.actual))
if __name__ == '__main__':
GQTest().run_test()
from openpyxl import load_workbook
class OperatorExcel:
def __init__(self, case_path=None):
if case_path:
self.case_path = case_path
else:
case_path = '../data/template_testcase.xlsx'
self.api_case = load_workbook(case_path)['api']
self.scene_case = load_workbook(case_path)['scene']
# 获取所有用例
def get_all_case(self):
case_data = []
for row in range(1, self.api_case.max_row+1):
case = []
for column in range(1, self.api_case.max_column+1):
case.append(self.api_case.cell(row=row, column=column).value)
case_data.append(case)
return case_data
def get_scene_case(self):
case_data = []
for row in range(1, self.scene_case.max_row + 1):
case = []
for column in range(1, self.scene_case.max_column + 1):
case.append(self.scene_case.cell(row=row, column=column).value)
case_data.append(case)
return case_data
if __name__ == '__main__':
# print(OperatorExcel().get_all_case())
print(OperatorExcel().get_scene_case())
\ No newline at end of file
from base import loginfo
from base.setting import setting
from base.base_request import ApiRequests
import json
# 获取登录后的cookie
def get_token():
loginfo.debug('token获取中……')
parameter = {"username": setting.login['username'],
"password": setting.login['password'],
"captcha": {"captcha": "", "timestamp": "", "sign": ""}}
res = ApiRequests().run_main('api/auth/login', data=parameter)
if 'success' in res:
loginfo.debug('token 获取成功')
return {'Cookie': '_t_logwire=' + json.loads(res)['data']['token']}
else:
loginfo.debug('获取失败')
home = C:\Python\Python37-32
include-system-site-packages = false
version = 3.7.5
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment