Exemple #1
0
import json
import unittest
from common1.configHttp import RunMain
import paramunittest
import geturlParams
import urllib.parse
# import pythoncom
import readExcel
from SaveParam.GetParam import UserLoginToken
from testCase.user import test1_01case
# pythoncom.CoInitialize()
import time

time.sleep(3)
# url = geturlParams.geturlParams().get_Url2_1()  # 调用我们的geturlParams获取我们拼接的URL
login_xls = readExcel.readExcel().get_xls('个人中心.xlsx', '24用户金币')


@paramunittest.parametrized(*login_xls)
class testSettleAddGoodsCart(unittest.TestCase):
    def setParameters(self, case_name, url, port, path, query, method,
                      expected, result):
        """
        set params
        :param case_name:
        :param path
        :param query
        :param method
        :return:
        """
        self.case_name = str(case_name)
Exemple #2
0
import json
import unittest
from common1.configHttp import RunMain
import paramunittest
import geturlParams
import urllib.parse
# import pythoncom
import readExcel
from SaveParam.GetParam import UserLoginToken
from testCase.user import test1_01case
# pythoncom.CoInitialize()
import time

time.sleep(3)
# url = geturlParams.geturlParams().get_Url2_1()  # 调用我们的geturlParams获取我们拼接的URL
login_xls = readExcel.readExcel().get_xls('个人中心.xlsx', '48个人中心首页业务员')


@paramunittest.parametrized(*login_xls)
class testSettleAddGoodsCart(unittest.TestCase):
    def setParameters(self, case_name, url, port, path, query, method,
                      expected, result):
        """
        set params
        :param case_name:
        :param path
        :param query
        :param method
        :return:
        """
        self.case_name = str(case_name)
Exemple #3
0
import json
import unittest
from common1.configHttp import RunMain
import paramunittest
import geturlParams
import urllib.parse
# import pythoncom
import readExcel
from SaveParam.GetParam import UserLoginToken
from testCase.user import test1_01case
# pythoncom.CoInitialize()
import time

time.sleep(3)
# url = geturlParams.geturlParams().get_Url2_1()  # 调用我们的geturlParams获取我们拼接的URL
login_xls = readExcel.readExcel().get_xls('个人中心.xlsx', '18账期汇总订单')


@paramunittest.parametrized(*login_xls)
class testSettleAddGoodsCart(unittest.TestCase):
    def setParameters(self, case_name, url, port, path, query, method,
                      expected, result):
        """
        set params
        :param case_name:
        :param path
        :param query
        :param method
        :return:
        """
        self.case_name = str(case_name)
Exemple #4
0
import json
import unittest
from common1.configHttp import RunMain
import paramunittest
import geturlParams
import urllib.parse
# import pythoncom
import readExcel
from SaveParam.GetParam import UserLoginToken
from testCase.user import test1_01case
# pythoncom.CoInitialize()
import time

time.sleep(3)
# url = geturlParams.geturlParams().get_Url2_1()  # 调用我们的geturlParams获取我们拼接的URL
login_xls = readExcel.readExcel().get_xls('个人中心.xlsx', '13待收货订单')


@paramunittest.parametrized(*login_xls)
class testSettleAddGoodsCart(unittest.TestCase):
    def setParameters(self, case_name, url, port, path, query, method,
                      expected, result):
        """
        set params
        :param case_name:
        :param path
        :param query
        :param method
        :return:
        """
        self.case_name = str(case_name)
Exemple #5
0
import json
import unittest
from common1.configHttp import RunMain
import paramunittest
import geturlParams
import urllib.parse
# import pythoncom
import readExcel
# pythoncom.CoInitialize()
from SaveParam.GetParam import UserLoginToken

# url = geturlParams.geturlParams().get_Url1_1()  # 调用我们的geturlParams获取我们拼接的URL
login_xls = readExcel.readExcel().get_xls('用户API.xlsx', '获取用户信息')


@paramunittest.parametrized(*login_xls)
class testUserFind(unittest.TestCase):
    def setParameters(self, case_name, url, port, path, query, method,
                      expected, result):
        """
        set params
        :param case_name:
        :param path
        :param query
        :param method
        :return:
        """
        self.case_name = str(case_name)
        self.url = str(url)
        self.port = str(int(port))
        self.path = str(path)
import unittest
import requests
import urllib.parse
from parameterized import parameterized
import paramunittest
import json
import ast
import readExcel
import a_helper as Helper

xls_data = readExcel.readExcel().get_default_xls()
# print(xls_data)


@paramunittest.parametrized(*xls_data)
class TestMy(unittest.TestCase):
    def setUp(self):
        Helper.cur_run_case_index = Helper.cur_run_case_index + 1
        print('\033[1;31m' + "\n----" +
              "第{}条用例执行情况".format(Helper.cur_run_case_index) + '\033[0m')
        pass

    def tearDown(self):
        pass

    def setParameters(self, case_name, url, method, query, par):
        self.case_name = str(case_name)
        self.url = url
        self.method = str(method).lower()
        self.query = str(query)
        self.par = str(par)
Exemple #7
0
import json
import unittest
from common1.configHttp import RunMain
import paramunittest
import geturlParams
import urllib.parse
# import pythoncom
import readExcel
from SaveParam.GetParam import UserLoginToken
from testCase.user import test1_01case
# pythoncom.CoInitialize()
import time

time.sleep(3)
url = geturlParams.geturlParams().get_Url2_1()  # 调用我们的geturlParams获取我们拼接的URL
login_xls = readExcel.readExcel().get_xls('商品.xlsx', '6根据ID获取特卖商品信息')

@paramunittest.parametrized(*login_xls)
class testGoodsSpecialSaleGoodsId(unittest.TestCase):
    def setParameters(self, case_name, url, port,  path, query, method, expected, result):
        """
        set params
        :param case_name:
        :param path
        :param query
        :param method
        :return:
        """
        self.case_name = str(case_name)
        self.url = str(url)
        self.port = str(int(port))
Exemple #8
0
import json
import unittest
from common.configHttp import RunMain
import paramunittest
import geturlParams
import urllib.parse
import pythoncom
import readExcel
pythoncom.CoInitialize()

url = geturlParams.GeturlParams().get_url()  # 调用geturlParams获取拼接的URL
shopAll_xls = readExcel.readExcel().get_xls('userCase.xlsx', 'shop')

# 获取该接口测试用例所有数据
shop_xls = []
for i in shopAll_xls:
    if i[0] == 'GetShoppingCart':
        shopData = i[1:]
        shop_xls.append(shopData)


@paramunittest.parametrized(*shop_xls)
class GetShoppingCart(unittest.TestCase):
    def setParameters(self, case_name, path, query, method):

        self.case_name = str(case_name)
        self.path = str(path)
        self.query = str(query)
        self.method = str(method)
       # self.expect_res = str(expect_res)
    totalcount = 0
    for test_suite in package_tests:
        for test_case in test_suite:
            suite.addTests(test_case)
            totalcount = totalcount + 1
        pass
    pass
    daimapath = test_case_dir + "/" + test_case_file_name  #代码路径
    datafilepath = Helper.test_data_dir + "/" + Helper.xls_name + "的" + Helper.sheet_name
    print('\033[1;31m' + "\n\n\n此次要执行的用例代码为:{},数据文件为:{}, 用例数为{}条".format(
        daimapath, datafilepath, str(totalcount)) + '\033[0m')
    return suite


if __name__ == '__main__':
    readExcel.readExcel()
    suite = create_suite()
    if (Helper.isResultToHtml):
        now_time = time.strftime("%Y-%m-%d %H_%M_%S")
        test_report_file_name = Helper.report_dir + now_time + '_result.html'
        result_title = "接口测试报告:"
        result_des = "请查看详细内容"

        fp = open(test_report_file_name, "wb")
        runner = HTMLTestRunner.HTMLTestRunner(stream=fp,
                                               title=result_title,
                                               description=result_des,
                                               verbosity=2)
        runner.run(suite)
        fp.close()
#user/test02case
import json
import unittest
from common.configHttp import RunMain
import paramunittest
import geturlParams
import urllib.parse
from common.sessionDB import Session
# import pythoncom
import readExcel
# pythoncom.CoInitialize()

url = geturlParams.geturlParams().get_Url_https_pay(
)  # 调用我们的geturlParams获取我们拼接的URL

login_xls = readExcel.readExcel().get_xls('userCase.xlsx', 'sc_pay')
#新增接口需修改


@paramunittest.parametrized(*login_xls)
class testUserLogin(unittest.TestCase):
    def setParameters(self, case_name, path, query, method, remark, auc):
        """
        set params
        :param case_name:
        :param path
        :param query
        :param method
        :return:
        """
        self.case_name = str(case_name)
Exemple #11
0
# @File: test_case.py
# @Time: 2019-08-19 15:00
import json
import time

import get_url_params
import readExcel
import unittest
import urllib.parse
import paramunittest

from common.request import HttpClient

url = get_url_params.geturlParams().get_create_project_url()
# login_xls = readExcel.readExcel().get_xls('userCase.xlsx','createProject')
login_xls = readExcel.readExcel().get_xls('userCase.xlsx','selectProject')
# login_xls = readExcel.readExcel().get_xls('userCase.xlsx','login')
from utils.get_md5 import getAppKeyMD5

@paramunittest.parametrized(*login_xls)
class testUserLogin(unittest.TestCase):

    def setParameters(self,case_name,path,query,method):
        """
        设置参数
        :param case_name:
        :param path:
        :param query:
        :param method:
        :return:
        """
Exemple #12
0
import json
import unittest
from common1.configHttp import RunMain
import paramunittest
import geturlParams
import urllib.parse
# import pythoncom
import readExcel
from SaveParam.GetParam import UserLoginToken
from testCase.user import test1_01case
# pythoncom.CoInitialize()
import time

time.sleep(3)
# url = geturlParams.geturlParams().get_Url2_1()  # 调用我们的geturlParams获取我们拼接的URL
login_xls = readExcel.readExcel().get_xls('个人中心.xlsx', '9单一商品收藏状态')


@paramunittest.parametrized(*login_xls)
class testSettleAddGoodsCart(unittest.TestCase):
    def setParameters(self, case_name, url, port, path, query, method,
                      expected, result):
        """
        set params
        :param case_name:
        :param path
        :param query
        :param method
        :return:
        """
        self.case_name = str(case_name)
Exemple #13
0
import json
import unittest
from common1.configHttp import RunMain
import paramunittest
import geturlParams
import urllib.parse
# import pythoncom
import time
import readExcel
# pythoncom.CoInitialize()

# url = geturlParams.geturlParams().get_Url1_3()  # 调用我们的geturlParams获取我们拼接的URL
login_xls = readExcel.readExcel().get_xls('业务员APP.xlsx', '8商品说明书')


@paramunittest.parametrized(*login_xls)
class testUserLogin(unittest.TestCase):
    def setParameters(self, case_name, url, port, path, query, method,
                      expected, result):
        """
        set params
        :param case_name:
        :param path
        :param query
        :param method
        :return:
        """
        self.case_name = str(case_name)
        self.url = str(url)
        self.port = str(int(port))
        self.path = str(path)
Exemple #14
0
import json
import unittest
from common1.configHttp import RunMain
import paramunittest
import geturlParams
import urllib.parse
# import pythoncom
import readExcel
from SaveParam.GetParam import UserLoginToken
from testCase.user import test1_01case
# pythoncom.CoInitialize()
import time

time.sleep(3)
# url = geturlParams.geturlParams().get_Url2_1()  # 调用我们的geturlParams获取我们拼接的URL
login_xls = readExcel.readExcel().get_xls('个人中心.xlsx', '6添加商品收藏')


@paramunittest.parametrized(*login_xls)
class testSettleAddGoodsCart(unittest.TestCase):
    def setParameters(self, case_name, url, port, path, query, method,
                      expected, result):
        """
        set params
        :param case_name:
        :param path
        :param query
        :param method
        :return:
        """
        self.case_name = str(case_name)
Exemple #15
0
import json
import unittest
from common1.configHttp import RunMain
import paramunittest
import geturlParams
import urllib.parse
# import pythoncom
import readExcel
from SaveParam.GetParam import UserLoginToken
from testCase.user import test1_01case
# pythoncom.CoInitialize()
import time

time.sleep(3)
# url = geturlParams.geturlParams().get_Url2_1()  # 调用我们的geturlParams获取我们拼接的URL
login_xls = readExcel.readExcel().get_xls('个人中心.xlsx', '57求购消息')


@paramunittest.parametrized(*login_xls)
class testSettleAddGoodsCart(unittest.TestCase):
    def setParameters(self, case_name, url, port, path, query, method,
                      expected, result):
        """
        set params
        :param case_name:
        :param path
        :param query
        :param method
        :return:
        """
        self.case_name = str(case_name)
Exemple #16
0
# _*_ coding:utf-8 _*_
# __author__ = 'dragon'
'''
这个函数主要是用来绘图
'''
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties  # 加入字体属性
import readExcel

font = FontProperties(fname=r"c:\windows\fonts\simsun.ttc", size=14)  # 加入字体属

# data:input data,showOrNot:是否显示图片ischinese:是否支持中文图注,saveFig:是否保存图片
# 默认参数 showOrNot=0,isChinese=0,saveFig=0:图片不显示,不显示中文图注,不保存图片(只在第一次时保存,且只有在showOrNot=1时才能保存图片)
# 中文图注暂时未实现,仅留一个借口
data = readExcel.readExcel()  # 调用默认的数据


def plotFigAll(data=data, showOrNot=0, isChinese=0, saveFig=0):
    #print len(data)
    for eachDevNum in range(len(data)/2):
        plotFigSig(data[2 * eachDevNum], data[2 * eachDevNum + 1], showOrNot, saveFig)
        plotFigMul(data[2 * eachDevNum], data[2 * eachDevNum + 1], showOrNot, saveFig)
    plt.show()


        # 为画图进行相关参数提取 ,并掉用相关的函数


def plotFigSig(classDev, dataDev, showOrNot, saveFig):
    if 1 == showOrNot:
        for eachSubPlot in range(4):
Exemple #17
0
import json
import unittest
from common1.configHttp import RunMain
import paramunittest
import geturlParams
import urllib.parse
# import pythoncom
import readExcel
from SaveParam.GetParam import UserLoginToken
from testCase.user import test1_01case
# pythoncom.CoInitialize()
import time

time.sleep(3)
# url = geturlParams.geturlParams().get_Url2_1()  # 调用我们的geturlParams获取我们拼接的URL
login_xls = readExcel.readExcel().get_xls('个人中心.xlsx', '14已出库订单')


@paramunittest.parametrized(*login_xls)
class testSettleAddGoodsCart(unittest.TestCase):
    def setParameters(self, case_name, url, port, path, query, method,
                      expected, result):
        """
        set params
        :param case_name:
        :param path
        :param query
        :param method
        :return:
        """
        self.case_name = str(case_name)
Exemple #18
0
import json
import unittest
from common1.configHttp import RunMain
import paramunittest
import geturlParams
import urllib.parse
# import pythoncom
import readExcel
from SaveParam.GetParam import UserLoginToken
from testCase.user import test1_01case
# pythoncom.CoInitialize()
import time

time.sleep(3)
# url = geturlParams.geturlParams().get_Url2_1()  # 调用我们的geturlParams获取我们拼接的URL
login_xls = readExcel.readExcel().get_xls('购物车与结算.xlsx', '1添加商品到购物车')

@paramunittest.parametrized(*login_xls)
class testSettleAddGoodsCart(unittest.TestCase):
    """"""
    def setParameters(self, case_name, url, port,  path, query, method, expected, result):
        """
        set params
        :param case_name:
        :param path
        :param query
        :param method
        :return:
        """
        self.case_name = str(case_name)
        self.url = str(url)
Exemple #19
0
import json
import unittest
from common.configHttp import RunMain
import paramunittest
import geturlParams
import urllib.parse
# import pythoncom
import readExcel
# pythoncom.CoInitialize()

url = geturlParams.geturlParams().get_Url()  # 调用我们的geturlParams获取我们拼接的URL
login_xls = readExcel.readExcel().get_xls('userCase.xlsx',
                                          'login')  #获取sheet名为login的数据


@paramunittest.parametrized(*login_xls)  #列表参数化
class testUserLogin(unittest.TestCase):
    def setParameters(self, case_name, path, query, method):
        """
        set params
        :param case_name:
        :param path
        :param query
        :param method
        :return:
        """
        self.case_name = str(case_name)
        self.path = str(path)
        self.query = str(query)
        self.method = str(method)
Exemple #20
0
import json
import unittest
from common1.configHttp import RunMain
import paramunittest
import geturlParams
import urllib.parse
# import pythoncom
import readExcel
from testCase.user import test1_01case
# pythoncom.CoInitialize()
import time

time.sleep(3)
# url = geturlParams.geturlParams().get_Url2_1()  # 调用我们的geturlParams获取我们拼接的URL
login_xls = readExcel.readExcel().get_xls('业务员APP.xlsx', '11更新购物车数量')


@paramunittest.parametrized(*login_xls)
class testSettleAddGoodsCart(unittest.TestCase):
    def setParameters(self, case_name, url, port, path, query, method,
                      expected, result):
        """
        set params
        :param case_name:
        :param path
        :param query
        :param method
        :return:
        """
        self.case_name = str(case_name)
        self.url = str(url)
Exemple #21
0
from functools import reduce
from readExcel import readExcel

readIDC = readExcel(r"IDC IP地址.xlsx")
sheet1 = readIDC.get_sheet('Sheet1')

class half_search:

    def BinarySearch(array, t):
        low = 0
        height = len(array) - 1
        while low < height:
            mid = int((low + height) / 2)
            if array[mid] < t:
                low = mid + 1
            elif array[mid] > t:
                height = mid - 1
            else:
                return array[mid]
        return False

    @staticmethod
    def ip_into_init(hs_list):
        hs_int = []
        flag=0
        for hs in hs_list:
            sp=hs.split('.')
            for s in sp:
                try:
                    if 255 >= int(s) >= 0:
                        flag = 1
Exemple #22
0
import json
import unittest
from common1.configHttp import RunMain
import paramunittest
import geturlParams
import urllib.parse
# import pythoncom
import readExcel
from SaveParam.GetParam import UserLoginToken
from testCase.user import test1_01case
# pythoncom.CoInitialize()
import time

time.sleep(3)
# url = geturlParams.geturlParams().get_Url2_1()  # 调用我们的geturlParams获取我们拼接的URL
login_xls = readExcel.readExcel().get_xls('个人中心.xlsx', '36发送短信验证码')

@paramunittest.parametrized(*login_xls)
class testSettleAddGoodsCart(unittest.TestCase):
    def setParameters(self, case_name, url, port,  path, query, method, expected, result):
        """
        set params
        :param case_name:
        :param path
        :param query
        :param method
        :return:
        """
        self.case_name = str(case_name)
        self.url = str(url)
        self.port = str(int(port))
Exemple #23
0
import json
import unittest
from csv import excel
import ddt
import json
from common.configHttp import RunMain
import paramunittest
import geturlParams
import urllib.parse
import readExcel
from BeautifulReport import BeautifulReport as bf  #导入BeautifulReport模块,这个模块也是生成报告的模块


url = geturlParams.geturlParams().get_Url()  # 调用我们的geturlParams获取我们拼接的URL
login_xls = readExcel.readExcel().get_xls('userLoginCase.xlsx', 'news')


@paramunittest.parametrized(*login_xls)
# @ddt.ddt
class testNews(unittest.TestCase):

    def setParameters(self, case_name, path, query, method, description, returnCode):
        """
        set params
        :param case_name: 用例名称
        :param path 请求路径
        :param query 请求参数
        :param method 请求方式
        :param description 用例描述
        :param returnCode 返回状态值
        :return:
Exemple #24
0
import json
import unittest
from common1.configHttp import RunMain
import paramunittest
import geturlParams
import urllib.parse
# import pythoncom
import readExcel
from SaveParam.GetParam import UserLoginToken
from testCase.user import test1_01case
# pythoncom.CoInitialize()
import time

time.sleep(3)
# url = geturlParams.geturlParams().get_Url2_1()  # 调用我们的geturlParams获取我们拼接的URL
login_xls = readExcel.readExcel().get_xls('个人中心.xlsx', '30充值余额')


@paramunittest.parametrized(*login_xls)
class testSettleAddGoodsCart(unittest.TestCase):
    def setParameters(self, case_name, url, port, path, query, method,
                      expected, result):
        """
        set params
        :param case_name:
        :param path
        :param query
        :param method
        :return:
        """
        self.case_name = str(case_name)
Exemple #25
0
import json
import unittest
from common.configHttp import RunMain
import paramunittest
import geturlParams
import urllib.parse
# import pythoncom
import readExcel
# pythoncom.CoInitialize()

url = geturlParams.geturlParams().get_Url()  # 调用我们的geturlParams获取我们拼接的URL
login_xls = readExcel.readExcel().get_xls('userCase.xlsx', '登录')


@paramunittest.parametrized(*login_xls)
class testUserLogin(unittest.TestCase):
    def setParameters(self, case_name, url, method, data):
        """
        set params
        :param case_name
        :param url
        :param method
        :param data
        :return
        """
        self.case_name = case_name
        self.url = url
        self.method = method
        self.data = data

    def description(self):
Exemple #26
0
import json
import unittest
from common1.configHttp import RunMain
import paramunittest
import geturlParams
import urllib.parse
# import pythoncom
import readExcel
from testCase.user import test1_01case
# pythoncom.CoInitialize()
import time

time.sleep(3)
# url = geturlParams.geturlParams().get_Url2_1()  # 调用我们的geturlParams获取我们拼接的URL
login_xls = readExcel.readExcel().get_xls('业务员APP.xlsx', '3修改密码')

@paramunittest.parametrized(*login_xls)
class testSettleAddGoodsCart(unittest.TestCase):
    def setParameters(self, case_name, url, port,  path, query, method, expected, result):
        """
        set params
        :param case_name:
        :param path
        :param query
        :param method
        :return:
        """
        self.case_name = str(case_name)
        self.url = str(url)
        self.port = str(int(port))
        self.path = str(path)
Exemple #27
0
import json
import unittest
from common1.configHttp import RunMain
import paramunittest
import geturlParams
import urllib.parse
# import pythoncom
import readExcel
from SaveParam.GetParam import UserLoginToken
from testCase.user import test1_01case
# pythoncom.CoInitialize()
import time

time.sleep(3)
url = geturlParams.geturlParams().get_Url2_1()  # 调用我们的geturlParams获取我们拼接的URL
login_xls = readExcel.readExcel().get_xls('商品.xlsx', '10商品列表阶梯价')


@paramunittest.parametrized(*login_xls)
class testGoodsTieredPricing(unittest.TestCase):
    def setParameters(self, case_name, url, port, path, query, method,
                      expected, result):
        """
        set params
        :param case_name:
        :param path
        :param query
        :param method
        :return:
        """
        self.case_name = str(case_name)
Exemple #28
0
import json
import unittest
from common1.configHttp import RunMain
import paramunittest
import geturlParams
import urllib.parse
# import pythoncom
import readExcel
from SaveParam.GetParam import UserLoginToken
from testCase.user import test1_01case
# pythoncom.CoInitialize()
import time

time.sleep(3)
# url = geturlParams.geturlParams().get_Url2_1()  # 调用我们的geturlParams获取我们拼接的URL
login_xls = readExcel.readExcel().get_xls('个人中心.xlsx', '35优惠券')


@paramunittest.parametrized(*login_xls)
class testSettleAddGoodsCart(unittest.TestCase):
    def setParameters(self, case_name, url, port, path, query, method,
                      expected, result):
        """
        set params
        :param case_name:
        :param path
        :param query
        :param method
        :return:
        """
        self.case_name = str(case_name)
Exemple #29
0
import json
import unittest
from common1.configHttp import RunMain
import paramunittest
import geturlParams
import urllib.parse
# import pythoncom
import readExcel
from testCase.user import test1_01case
from SaveParam.GetParam import UserLoginToken
# pythoncom.CoInitialize()
import time

time.sleep(3)
url = geturlParams.geturlParams().get_Url2_1()  # 调用我们的geturlParams获取我们拼接的URL
login_xls = readExcel.readExcel().get_xls('购物车与结算.xlsx', '6获取特卖商品购物车')
with open('./SaveParam/login_token.txt', 'r', encoding='utf-8') as f:
    hesytoken = f.read()  # 获取cookies
    f.close()


@paramunittest.parametrized(*login_xls)
class testSettleGetRandomPriceBasket(unittest.TestCase):
    def setParameters(self, case_name, url, port,  path, query, method, expected, result):
        """
        set params
        :param case_name:
        :param path
        :param query
        :param method
        :return:
Exemple #30
0
import json
import unittest
from common1.configHttp import RunMain
import paramunittest
import geturlParams
import urllib.parse
# import pythoncom
import readExcel
from SaveParam.GetParam import UserLoginToken
from testCase.user import test1_01case
# pythoncom.CoInitialize()
import time

time.sleep(3)
url = geturlParams.geturlParams().get_Url2_1()  # 调用我们的geturlParams获取我们拼接的URL
login_xls = readExcel.readExcel().get_xls('商品搜索API.xlsx', '3生产厂家首字母键值对返回')


@paramunittest.parametrized(*login_xls)
class testSettleManufacturers(unittest.TestCase):
    def setParameters(self, case_name, url, port, path, query, method,
                      expected, result):
        """
        set params
        :param case_name:
        :param path
        :param query
        :param method
        :return:
        """
        self.case_name = str(case_name)
Exemple #31
0
import json
import unittest
from common1.configHttp import RunMain
import paramunittest
import geturlParams
import urllib.parse
# import pythoncom
import readExcel
from testCase.user import test1_01case
from SaveParam.GetParam import UserLoginToken
# pythoncom.CoInitialize()
import time

time.sleep(3)
url = geturlParams.geturlParams().get_Url2_1()  # 调用我们的geturlParams获取我们拼接的URL
login_xls = readExcel.readExcel().get_xls('购物车与结算.xlsx', '10结算购物车')


@paramunittest.parametrized(*login_xls)
class testSettleAddGoodsCart(unittest.TestCase):
    def setParameters(self, case_name, url, port, path, query, method,
                      expected, result):
        """
        set params
        :param case_name:
        :param path
        :param query
        :param method
        :return:
        """
        self.case_name = str(case_name)
Exemple #32
0
	bus5:pc+hairdryer2
	bus6:pc+phone
	bus7:pc+fan2
	bus8:pc+hairdryer3
	bus9:pc+fan3
	bus10:pc+phone+fan1->fan2->fan3->fan4->fan关->phone关->关
    bus11:fan4->phone->phone关-pc(47)->fan3->fan2(69)->fan1(80)->fan关-关
	bus12:hairdryer1->pc->pad(26)->hairdryer1关(38)->pad关(49)->关
	bus13:hairdryer1->kettle(22)-hairdryer关(32)->关
#################################################################################################################################
	data[18]:bus1的起点

'''
import readExcel
#data中偶数是用电器的类别,如data[0],data[2],相邻奇数保存在用电器的电气数据如data[1],data[3]
data = readExcel.readExcel()
#print data[18]
#通过功率区分两个用电器,第一个参数是用电器名字,第二个用参数是数据包括P,PF,U,I
def class2devBy_P(dataName=None,data=None):
	if (dataName == None or data == None):
		print "No dev name or data in 'class2devBy_P'"
	else:
		print "data analyze \'%s\'" % dataName
		relativeDataP=[]
		for i in range(len(data["P"])):
			if 0 == i:
				relativeDataP.append(int(data["P"][0]))
			else:
				relativeDataP.append(int(data["P"][i]) - int(data["P"][i-1]))
		#print relativeDataP
		fingerPrint(relativeDataP,'P',15,-15)