# -*- coding: UTF-8 -*- #_auther:zhangxin #date : 2020/3/31 import json import allure import pytest import requests from dutil.res_diff import res_diff from dutil.find_case import findCase from dutil.make_ddt import MakeDdt from conf.sysconfig import HOST casepath = findCase(__file__, 'findGoodsDetailTaskByParams.yml') test_cases = MakeDdt(casepath).makeData() class TesttestFindGoodsDetailTaskByParams(): @allure.title("查询商详页展示任务说明") @pytest.mark.parametrize( "method, url, params, data,headers,cookies, proxies, status_code, expectData", test_cases) def test_findGoodsDetailTaskByParams(self, method, url, params, data, headers, cookies, proxies, status_code, expectData): '''品牌收藏''' url = HOST + '/dal_task_system_cur_server/server/taskSystemCurController/findGoodsDetailTaskByParams' res = requests.get(url, headers=headers, params={'sku': '111111'}) print(res.json()) assert {} == res_diff(expectData, res.json())
# 2019-09-18 09:53 import json import allure import pytest import requests from dutil.res_diff import res_diff from dutil.find_case import findCase from dutil.make_ddt import MakeDdt from conf.sysconfig import HOST from conf.sysconfig import COLLECT_ONE_SKUS from conf.sysconfig import COLLECT_TWO_SKUS from conf.sysconfig import COLLECT_ALL_SKUS casepath = findCase(__file__, 'getUserCollectSkuList.yml', n=1) test_cases = MakeDdt(casepath).makeData_V2() casepath1 = findCase(__file__, 'getUserCollectCategoryList.yml', n=1) test_cases1 = MakeDdt(casepath1).makeData_V2() class TestCollectSku(): '''品牌收藏 SKU 纬度的所有接口''' def bCollectedSku(self, headers, sku): '''判断商品是否收藏''' bCollectedSku_url = HOST + '/xc_collect/userCollect/bCollectedSku.do' bres = requests.get(bCollectedSku_url, headers=headers, params={'sku': sku}) return bres
# -*- coding: utf-8 -*- import json import allure import random import pytest import requests from dutil.find_case import findCase from dutil.make_ddt import MakeDdt from conf.sysconfig import XC_HOST, ORDER_DB from conf.mysqlconf import sql_update, pgsql_update from dutil.res_diff import res_diff from dutil.common import ranstr casepath = findCase(__file__, 'createOrder.yml', n=2) test_cases = MakeDdt(casepath).makeData_V2() casepath_1 = findCase(__file__, 'update_status.yml', n=2) test_cases_1 = MakeDdt(casepath_1).makeData_V2() casepath_2 = findCase(__file__, 'batchStockAdd.yml', n=2) test_cases_2 = MakeDdt(casepath_2).makeData_V2() class TestAppOrderCreate(): @allure.title('增加用户的余额') @allure.description('通过修改 t_account 表的数据库更新用户的可用余额') @pytest.mark.dependency(name="balanceUser") def test_balanceUser(self): sql = "update t_account set active_money = 10000 where user_id = '{}'".format( 844354)
# +--+--+--+--+--+--+--+--+--+--+--+--+--+ # 2019-09-18 09:53 import json import allure import pytest import random import requests from dutil.res_diff import res_diff from dutil.find_case import findCase from dutil.make_ddt import MakeDdt from conf.sysconfig import UC_HOST from util.common import ranstr, queryUserById, queryShopById casepath = findCase(__file__, 'uc_inner_manager_shop.yml', n=2) app_stock_cases = MakeDdt(casepath).makeData_V2() class TestUcenterInnerManagerShop(): ''' 基于 yaml 文件数据的自动化case ''' @allure.title("{name}") @pytest.mark.parametrize("method, url, params, data, headers, cookies, proxies, status_code, expectData, name", app_stock_cases) def test_success(self, method, url, params, data, headers, cookies, proxies, status_code, expectData, name): '''/inner/manager/shop''' allure.attach('{0}'.format(url), name='请求url', attachment_type=allure.attachment_type.TEXT) allure.attach('{0}'.format(json.dumps(headers)), name='请求headers', attachment_type=allure.attachment_type.TEXT) allure.attach('{0}'.format(json.dumps(params)), name='请求param', attachment_type=allure.attachment_type.TEXT) allure.attach('{0}'.format(json.dumps(data)), name='请求data', attachment_type=allure.attachment_type.TEXT)