Example #1
0
# -*- coding:utf-8 -*-
# -*- coding:utf-8 -*-
import unittest
import requests
import paramunittest
import readConfig as readConfig
from common import common
from common import configHttp
from common.Log import Logg
localReadConfig = readConfig.ReadConfig()
localConfigHttp = configHttp.ConfigHttp()
queryStudentById_xls = common.get_xls("userCase.xlsx", "queryStudentById")
log = Logg()


@paramunittest.parametrized(*queryStudentById_xls)
# 根据学员ID查询学员  http://api-shuangshi.tengyue360.com/backend/student/student/queryStudentById
class QueryStudentById(unittest.TestCase):
    def setParameters(self, case_name, method, url, parameter, resultType,
                      errno, error, cityName):
        self.case_name = str(case_name)
        self.method = str(method)
        self.url = str(url)
        self.parameter = str(parameter)
        self.resultType = str(resultType)
        self.errno = str(errno)
        self.error = str(error)
        self.cityName = str(cityName)

    def description(self):
        self.case_name
Example #2
0
import requests
#获取config里面的信息
import readConfig as readConfig
import os
from xlrd import open_workbook
from common import configHttp as configHttp
from common.Log import Logg
log = Logg()  #调用初始化
import json
#导入方法读取baseurl
localReadConfig = readConfig.ReadConfig()
#获取文件的路径
proDir = readConfig.proDir
#这里调用了
localConfigHttp = configHttp.ConfigHttp()


#获取学生端登陆token 公共方法
def get_visitor_token():
    send_param = {
        "phone": 14050000000,
        "password": "******",
        "messageCode": "0",
        "loginType": "1",
        "timestamp": "0"
    }
    urllist = localReadConfig.get_http("BASEURL")
    #http://api-shuangshi.tengyue360.com
    headers = {"Content-Type": 'application/json'}
    res = requests.post("http://" + urllist + "/backend/student/unauth/login",
                        data=json.dumps(send_param),
Example #3
0
import os
import unittest
#导入log模块
from common.Log import Logg
#读取配置信息
import readConfig as readConfig
#生成excel报告
from common import HTMLTestRunner
#实例化调用读取配置信息
localReadConfig = readConfig.ReadConfig()
#调用LOG方法
cc=Logg();
class AllTest:
    #初始化值,获取各个路径,设置全局变量
    def __init__(self):
        global logger, resultPath
        logger = cc.get_logger();
        #获取报告路径
        resultPath = cc.get_report_path()
        #C:\Users\Administrator\Desktop\interfaceTest\result\report.html
        #得到文件的路径/caselist.txt
        self.caseListFile = os.path.join(readConfig.proDir, "caselist.txt")
        #self.caseListFile=C:\Users\Administrator\Desktop\interfaceTest\caselist.txt
        #获取文件的名字路径
        self.caseFile = os.path.join(readConfig.proDir, "testCase")
        #self.caseFile=C:\Users\Administrator\Desktop\interfaceTest\testCase
        #定义了空列表
        self.caseList = []
        #user/testStudentLogin user/testqueryStudentById
    #设置执行的case
    def set_case_list(self):