Example #1
0
#author:zwx
import json
import unittest
import paramunittest
import requests
import urllib.parse
import read.readExcel as readExcel
from common.configHttp import RunMain
import read.readConfig as readConfig

push_xls = readExcel.ReadExcel().get_xls("login.xls", "push")
url = readConfig.ReadConfig().get_http("xcxbaserurl")  #获取配置文件中的url地址
gzhurl = readConfig.ReadConfig().get_http("gzhbaseurl")


@paramunittest.parametrized(*push_xls)
class testpush(unittest.TestCase):
    def setParameters(self, case_name, path, data, method, isTest):
        self.case_name = str(case_name)
        self.path = str(path)
        self.data = str(data)
        self.method = str(method)
        self.isTest = str(isTest)

    #调用测试方法
    def testuserOrder(self):
        self.pushlog()
        self.shareposter()

    #添加推送记录
    def pushlog(self):
Example #2
0
import json
import unittest
import paramunittest
import urllib.parse
import read.readExcel as readExcel
from common.configHttp import RunMain
import read.readConfig as readConfig

login_xls = readExcel.ReadExcel().get_xls("login.xls", "shagnhu")
url = readConfig.ReadConfig().get_http("baseurl")  #获取配置文件中的url地址


#@paramunittest.parametrized(*变量名)-----变量名为excel文件,
#setParameters方法里面的参数为excel文件中的列的变量名,必须与之完全一样,不能多加和少减
@paramunittest.parametrized(*login_xls)
class testUserLogin(unittest.TestCase):
    def setParameters(self, case_name, path, data, method, isTest):
        self.case_name = str(case_name)
        self.path = str(path)
        self.data = str(data)
        self.method = str(method)
        self.isTest = str(isTest)

    def description(self):
        self.case_name

    def setUp(self):
        print(self.case_name + "------------测试开始------------------")

    #调用测试方法
    def testShanghu(self):
Example #3
0
#author:zwx
import json
import unittest
import paramunittest
import requests
import urllib.parse
import read.readExcel as readExcel
from common.configHttp import RunMain
import read.readConfig as readConfig

order_xls = readExcel.ReadExcel().get_xls("login.xls", "order")
url = readConfig.ReadConfig().get_http("xcxbaserurl")  #获取配置文件中的url地址


@paramunittest.parametrized(*order_xls)
class testUserOrder(unittest.TestCase):
    def setParameters(self, case_name, path, data, method, isTest):
        self.case_name = str(case_name)
        self.path = str(path)
        self.data = str(data)
        self.method = str(method)
        self.isTest = str(isTest)

    #调用测试方法
    def testuserOrder(self):
        self.OrderCheckResult()
        self.orderclose()
        self.innerbuyorder()

    '''正常下单流程参数解释
        "PushlogId": "c450a7ac-000e-4815-8c78-368cd7660269", 推广人id
Example #4
0
import json
import paramunittest
from common.configHttp import RunMain
import unittest
import read.readConfig as readConfig
import read.readExcel as readExcel

getclass_xls = readExcel.ReadExcel().get_xls("getclass.xlsx", "class")
url = readConfig.ReadConfig().get_http("baseurl")


@paramunittest.parametrized(*getclass_xls)
class testGetClass(unittest.TestCase):
    def setParameters(self, case_name, path, data, method):
        self.case_name = case_name
        self.path = path
        self.data = data
        self.method = method

    def description(self):
        self.case_name

    def setUp(self):
        print("测试开始")

    def testGetClass(self):
        self.getClass()

    def tearDown(self):
        print("测试结束")
Example #5
0
import json
import paramunittest
import write.WriteExcel as WriteExcel
from common.configHttp import RunMain
import unittest
import read.readConfig as readConfig
import read.readExcel as readExcel
import getPath

book = WriteExcel.writeExcel()
basepath = getPath.get_basepath()
EnterShop = readExcel.ReadExcel().get_xls("EnterShop.xlsx", "shop")
url = readConfig.ReadConfig().get_http("baseurl")


@paramunittest.parametrized(*EnterShop)
class testEnterShop(unittest.TestCase):
    def setParameters(self, case_name, path, data, method):
        self.case_name = case_name
        self.path = path
        self.data = data
        self.method = method

    def description(self):
        self.case_name

    def setUp(self):
        print("测试开始")

    def testGetEnterShop(self):
        self.GetEnterShop()
Example #6
0
import json
import unittest
import paramunittest
import requests
import urllib.parse
import read.readExcel as readExcel
from common.configHttp import RunMain
import read.readConfig as readConfig
import common.getCommonInfo as getCommonInfo

ship_xls = readExcel.ReadExcel().get_xls("login.xls", "ship")
url = readConfig.ReadConfig().get_http("gzhbaseurl")  #获取配置文件中的url地址
ownerid = getCommonInfo.shipOwnerId


@paramunittest.parametrized(*ship_xls)
class testShip(unittest.TestCase):
    def setParameters(self, case_name, path, data, method, isTest):
        self.case_name = str(case_name)
        self.path = str(path)
        self.data = str(data)
        self.method = str(method)
        self.isTest = str(isTest)

    #调用测试方法
    def testShip(self):
        self.getCategorys()
        self.gettags()
        # self.addship()
        # self.shiplist()
        # self.shipdetail()
import json
import unittest
import paramunittest
import urllib.parse
import read.readExcel as readExcel
from common.configHttp import RunMain
import read.readConfig as readConfig

login_xls = readExcel.ReadExcel().get_xls("login.xls", "login")
url = readConfig.ReadConfig().get_http("loginurl")


@paramunittest.parametrized(*login_xls)
class testUserLogin(unittest.TestCase):
    def setParameters(self, case_name, path, data, method):
        self.case_name = str(case_name)
        self.path = str(path)
        self.data = str(data)
        self.method = str(method)

    def description(self):
        self.case_name

    def setUp(self):
        print(self.case_name + "测试开始前准备")

    #调用测试方法
    def testLogin(self):
        self.checkResult()

    def tearDown(self):
Example #8
0
import json
import paramunittest
import write.WriteExcel as WriteExcel
from common.configHttp import RunMain
import unittest
import read.readConfig as readConfig
import read.readExcel as readExcel
import getPath

book = WriteExcel.writeExcel()
basepath = getPath.get_basepath()
GetShopList = readExcel.ReadExcel().get_xls("GetShopList.xlsx", "shoplist")
url = readConfig.ReadConfig().get_http("baseurl")


@paramunittest.parametrized(*GetShopList)
class testGetShopList(unittest.TestCase):
    def setParameters(self, case_name, path, data, method):
        self.case_name = case_name
        self.path = path
        self.data = data
        self.method = method

    def description(self):
        self.case_name

    def setUp(self):
        print("测试开始")

    def testGetShopList(self):
        self.GetShopList()
Example #9
0
import json
import unittest
import paramunittest
import urllib.parse
import read.readExcel as readExcel
from common.configHttp import RunMain
import read.readConfig as readConfig

login_xls = readExcel.ReadExcel().get_xls("gzh.xls",
                                          "gzhlogin")  #引入excel用例文档中需要的
url = readConfig.ReadConfig().get_http("gzhbaseurl")  #获取配置文件中的url地址


#@paramunittest.parametrized(*变量名)-----变量名为excel文件,
#setParameters方法里面的参数为excel文件中的列的变量名,必须与之完全一样,不能多加和少减
@paramunittest.parametrized(*login_xls)
class testT(unittest.TestCase):
    '''def _init_(self):
        global ShipOwnerId
        ShipOwnerId = {}
    def set_value(key, value):
        """ 定义一个全局变量 """
        ShipOwnerId[key] = value

    def get_value(key, defValue=None):
        #""" 获得一个全局变量,不存在则返回默认值 """
        try:
            return ShipOwnerId[key]
        except KeyError:
            return defValue
    def settest(self):
Example #10
0
import json
import unittest
import paramunittest
import requests
import urllib.parse
import read.readExcel as readExcel
from common.configHttp import RunMain
import read.readConfig as readConfig
import common.getCommonInfo as getCommonInfo

ware_xls = readExcel.ReadExcel().get_xls("ware.xls","ware")
url = readConfig.ReadConfig().get_http("gzhonlineurl")#获取配置文件中的url地址
ownerid = getCommonInfo.shipOwnerId

@paramunittest.parametrized(*ware_xls)
class testware(unittest.TestCase):
    def setParameters(self,case_name,path,data,method,isTest):
        self.case_name = str(case_name)
        self.path = str(path)
        self.data = str(data)
        self.method = str(method)
        self.isTest = str(isTest)
    #调用测试方法
    def testware(self):
        self.recommendlist()
        self.alllist()
        self.searchlist()
        self.activewarelist()
        self.innerbuy()
        self.detail()
        self.pushdetail()
Example #11
0
import json
import unittest
import paramunittest
import requests
import urllib.parse
import read.readExcel as readExcel
from common.configHttp import RunMain
import read.readConfig as readConfig
import common.getCommonInfo as getCommonInfo

showcase_xls = readExcel.ReadExcel().get_xls("gzh_showcase.xls","showcase")
url = readConfig.ReadConfig().get_http("gzhbaseurl")#获取配置文件中的url地址
shipOwnerId = getCommonInfo.shipOwnerId
wareId = getCommonInfo.getWareId()
xcxtoken = getCommonInfo.getXcxToken()


@paramunittest.parametrized(*showcase_xls)
class testgzxcxcase(unittest.TestCase):
    def setParameters(self,case_name,path,data,method,isTest):
        self.case_name = str(case_name)
        self.path = str(path)
        self.data = str(data)
        self.method = str(method)
        self.isTest = str(isTest)
    #调用测试方法
    def testgzxcxcase(self):
        self.getAccountInfo()
        self.getBuyrecord()
        self.getFavoriteware()
        self.getCanclefavoriteware()
Example #12
0
import json
import unittest
import paramunittest
import requests
import urllib.parse
import read.readExcel as readExcel
from common.configHttp import RunMain
import read.readConfig as readConfig
import common.getCommonInfo as getCommonInfo

gzhsy_xls = readExcel.ReadExcel().get_xls("gzhsy.xls",
                                          "recent7dayspushcounttop3")
url = readConfig.ReadConfig().get_http("gzhbaseurl")  #获取配置文件中的url地址
ownerid = getCommonInfo.shipOwnerId


@paramunittest.parametrized(*gzhsy_xls)
class testgzhsy(unittest.TestCase):
    def setParameters(self, case_name, path, data, method, isTest):
        self.case_name = str(case_name)
        self.path = str(path)
        self.data = str(data)
        self.method = str(method)
        self.isTest = str(isTest)

    #调用测试方法
    def testgzhsy(self):
        self.recent7dayspushcounttop3()
        self.recent7dayspushrank()
        self.recent7dayspushstatistics()
        self.indexcarousel()